summaryrefslogtreecommitdiff
path: root/src/Fl_Search_Chooser.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-26 20:05:20 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-26 20:05:20 +0100
commit375d87a9b0ec1cf2fffd705adb870c86144d2400 (patch)
tree1e8e05e7cd58686628d0f4622622456613a42e4d /src/Fl_Search_Chooser.cxx
parent45425dd047b791fe63f13a46a3251c529cfffc94 (diff)
Replace the C++ implementation with the Rust port
The Rust port (formerly gipfel-rs) is now the official successor to the FLTK/GSL C++ code base. This squashes the port into a single commit and removes the C++ sources (they remain in the git history below). Layout: crates/gipfel-core headless core: hills, panorama geometry, projections (maxima-generated derivatives), pure-Rust LM fit, gipfel: JPEG comment + EXIF I/O, profiles, stitching crates/gipfel-cli command-line tools (export, info, stitch, profiles) crates/gipfel-app Cosmic DE (libcosmic) GUI, binary name `gipfel` codegen/ maxima scripts + regen.sh for the projection code tests/ golden files + C++ reference harnesses (historical) The original README is kept for now; it will be updated to describe the Rust build. gipfel.dat, AUTHORS, ChangeLog and NEWS are unchanged.
Diffstat (limited to 'src/Fl_Search_Chooser.cxx')
-rw-r--r--src/Fl_Search_Chooser.cxx137
1 files changed, 0 insertions, 137 deletions
diff --git a/src/Fl_Search_Chooser.cxx b/src/Fl_Search_Chooser.cxx
deleted file mode 100644
index 286516c..0000000
--- a/src/Fl_Search_Chooser.cxx
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// Copyright 2006-2009 Johannes Hofmann <Johannes.Hofmann@gmx.de>
-//
-// This software may be used and distributed according to the terms
-// of the GNU General Public License, incorporated herein by reference.
-
-#include <stdio.h>
-#include <string.h>
-#include <FL/Fl.H>
-#include <FL/Fl_Window.H>
-#include <FL/Fl_Button.H>
-#include "Fl_Search_Chooser.H"
-
-int
-Fl_Search_Browser::find_prefix(const char *p) {
- int i = find_prefix(p, 1, size());
- if (i == -1) {
- return 1;
- } else {
- deselect();
- middleline(i);
- select(i);
- return 0;
- }
-}
-
-int
-Fl_Search_Browser::find_prefix(const char *p, int s, int e) {
- if (s < 0 || e > size() || s > e) {
- fprintf(stderr, "Invalid search range %d %d\n", s, e);
- return 1;
- } else if (e - s <= 1) {
- if (strncasecmp(p, text(s), strlen(p)) == 0) {
- return s;
- } else if (strncasecmp(p, text(e), strlen(p)) == 0){
- return e;
- } else {
- return -1;
- }
- } else {
- int med = s + (e - s) / 2;
- if (strncasecmp(p, text(med), strlen(p)) > 0) {
- return find_prefix(p, med, e);
- } else {
- return find_prefix(p, s, med);
- }
- }
-}
-
-void
-Fl_Search_Chooser::input_cb(Fl_Input* in, void*c) {
- Fl_Search_Browser *sb = ((Fl_Search_Chooser *) c)->sb;
- sb->find_prefix(in->value());
-}
-
-void
-Fl_Search_Chooser::ok_cb(Fl_Input* in, void*c) {
- Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c;
- sc->close();
-}
-
-void
-Fl_Search_Chooser::cancel_cb(Fl_Input* in, void*c) {
- Fl_Search_Chooser *sc = (Fl_Search_Chooser *) c;
- sc->sb->deselect();
- sc->close();
-}
-
-class Fl_Search_Input : public Fl_Input {
- public:
- Fl_Search_Input(int x, int y, int w, int h, const char *title) :
- Fl_Input(x, y, w, h, title) {}
- int handle(int event) {
- if (event == FL_KEYBOARD &&
- (Fl::event_key() == FL_Up || Fl::event_key() == FL_Down)) {
- return 0;
- } else {
- return Fl_Input::handle(event);
- }
- }
-};
-
-Fl_Search_Chooser::Fl_Search_Chooser(const char *title) : Fl_Window(320, 320, title?title:"Choose") {
- callback((Fl_Callback*) cancel_cb, this);
- visible_focus = Fl::visible_focus();
- Fl::visible_focus(0);
- Fl_Group *g = new Fl_Group(10, 10, w() - 10, h() - 10);
- sb = new Fl_Search_Browser(g->x(), g->y(), g->w() , g->h() - 100, NULL);
- sb->type(FL_HOLD_BROWSER);
- Fl_Input *in = new Fl_Search_Input(g->x()+50, g->h()-80, g->w()-80, 20, "Search");
- in->callback((Fl_Callback*) input_cb, this);
- in->when(FL_WHEN_CHANGED);
- Fl_Button *cancel_b = new Fl_Button(g->w()-200, g->h()-30, 80, 25, "Cancel");
- cancel_b->callback((Fl_Callback*) cancel_cb, this);
- Fl_Button *ok_b = new Fl_Button(g->w()-100, g->h()-30, 80, 25, "Ok");
- ok_b->callback((Fl_Callback*) ok_cb, this);
- Fl::focus(in);
- g->end();
- end();
-}
-
-void
-Fl_Search_Chooser::close() {
- hide();
- Fl::visible_focus(visible_focus);
-}
-
-void
-Fl_Search_Chooser::add(const char *t, void *d) {
- sb->add(t, d);
-}
-
-void *
-Fl_Search_Chooser::data() {
- int v = sb->value();
- if (v) {
- return sb->data(v);
- } else {
- return NULL;
- }
-}
-
-int
-Fl_Search_Chooser::handle(int event) {
- switch(event) {
- case FL_KEYBOARD:
- int key = Fl::event_key();
-
- if (key == FL_Up || key == FL_Down) {
- return sb->handle(event);
- } else if (key == FL_Enter) {
- close();
- }
- }
-
- return Fl_Window::handle(event);
-}