1 # data file for the Fltk User Interface Designer (fluid)
4 i18n_include <libintl.h>
8 decl {\#include <faraon.H>} {global
11 decl {\#include <FL/fl_ask.H>} {global
14 decl {\#include <FL/Fl_Preferences.H>} {global
17 decl {\#include <Flek/Fl_Toggle_Tree.H>} {global
20 decl {\#include <scroll.H>} {public global
23 decl {\#include "slice.xpm"} {}
25 decl {\#include "note.xpm"} {}
27 decl {\#include "file.xpm"} {}
29 decl {Fl_Pixmap slice_pixmap(slice_xpm_data);} {}
31 decl {Fl_Pixmap note_pixmap(note_xpm_data);} {}
33 decl {Fl_Pixmap file_pixmap(file_xpm_data);} {}
35 decl {Fl_Toggle_Tree *config_tree;} {global
38 decl {Fl_Toggle_Tree *slices_tree;} {global
41 decl {Fl_Toggle_Tree *select_slice_tree;} {global
44 decl {Fl_Toggle_Tree *notes_tree;} {global
47 decl {Fl_Toggle_Tree *files_tree;} {global
50 decl {Fl_Toggle_Tree *fill_tree;} {}
52 decl {Fl_Toggle_Tree *browse_tree;} {}
54 decl {sfinx_slice_t *fill_tree_except;} {global
57 decl {u32_t fill_tree_mask;} {global
60 decl {sfinx_file_t current_file(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);} {}
62 Function {fill_objects_tree(Fl_Toggle_Tree *ft, u32_t m, sfinx_slice_t *except, bool force)} {private return_type void
66 fill_tree_except = except;
67 app->refresh_slices(force);} {}
70 Function {relink_slice_action()} {private return_type void
72 code {sfinx_slice_t slice(SFINX_SLICE_RELINK);
73 // slice to be relinked
74 Fl_Toggle_Node *node = slices_tree->selected();
77 Fl_Toggle_Node *snode = select_slice_tree->selected();
80 sfinx_slice_t *selected = (sfinx_slice_t *)snode->user_data();
81 sfinx_slice_t *rslice = (sfinx_slice_t *)node->user_data();
82 slice.id = rslice->id;
84 slice.parent_id = selected->id;
85 debug("moving from %lld to %lld", rslice->parent_id, selected->id);
86 app->sfinx.send(slice);
87 fill_objects_tree(slices_tree, SFINX_SLICE_OBJECT, 0, 1); // force refresh} {}
90 Function {select_note_atag_action()} {private return_type void
92 code {sfinx_object_t *obj;
93 Fl_Toggle_Node *node = select_slice_tree->selected();
96 if (node->can_open()) // slice
97 obj = ((sfinx_slice_t *)node->user_data())->object();
99 obj = (sfinx_object_t *)node->user_data();
100 Fl_Toggle_Node *snode = notes_tree->selected();
101 sfinx_object_t *sobj = (sfinx_object_t *)snode->user_data();
102 if (sobj == obj) // try to self tag
104 if (note_mtag_b->user_data() && !obj->cmp((sfinx_object_t *)note_mtag_b->user_data())) // already set as main tag
106 for (int i = 1; i <= note_tags_br->size(); i++) {
107 if (!obj->cmp((sfinx_object_t *)note_tags_br->data(i))) // already set as additional tag
110 string s = obj->name + " [ " + obj->description + " ]";
111 note_tags_br->add(s.c_str(), obj);
112 note_tags_br->redraw();} {}
115 Function {select_note_mtag_action()} {private return_type void
117 code {sfinx_object_t *obj;
118 Fl_Toggle_Node *node = select_slice_tree->selected();
121 if (node->can_open()) // slice
122 obj = ((sfinx_slice_t *)node->user_data())->object();
124 obj = (sfinx_object_t *)node->user_data();
125 Fl_Toggle_Node *snode = notes_tree->selected();
126 sfinx_object_t *sobj = (sfinx_object_t *)snode->user_data();
127 if (sobj == obj) // try to self tag
129 note_mtag_b->user_data(obj);
130 note_mtag_b->copy_label((obj->name + " [ " + obj->description + " ]").c_str());
131 note_mtag_b->redraw();
132 // check for additional slices if it is here - remove it
133 for (int i = 1; i <= note_tags_br->size(); i++) {
134 if (!obj->cmp((sfinx_object_t *)note_tags_br->data(i))) {
135 note_tags_br->remove(i);
141 Function {select_file_mtag_action()} {private return_type void
143 code {sfinx_object_t *obj;
144 Fl_Toggle_Node *node = select_slice_tree->selected();
147 if (node->can_open()) // slice
148 obj = ((sfinx_slice_t *)node->user_data())->object();
150 obj = (sfinx_object_t *)node->user_data();
151 file_mtag_b->user_data(obj);
152 file_mtag_b->copy_label((obj->name + " [ " + obj->description + " ]").c_str());
153 file_mtag_b->redraw();
154 // check for additional tags if it is here - remove it
155 for (int i = 1; i <= file_tags_br->size(); i++) {
156 if (!obj->cmp((sfinx_object_t *)file_tags_br->data(i))) {
157 file_tags_br->remove(i);
163 Function {select_file_atag_action()} {private return_type void
165 code {sfinx_object_t *obj;
166 Fl_Toggle_Node *node = select_slice_tree->selected();
170 if (node->can_open()) { // slice
171 obj = ((sfinx_slice_t *)node->user_data())->object();
172 s = obj->name + " [ " + obj->description + " ]";
174 obj = (sfinx_object_t *)node->user_data();
175 s = obj->name + obj->description;
177 if (file_mtag_b->user_data() && !obj->cmp((sfinx_object_t *)file_mtag_b->user_data())) // already set as main tag
179 for (int i = 1; i <= file_tags_br->size(); i++) {
180 if (!obj->cmp((sfinx_object_t *)file_tags_br->data(i))) // already set as additional tag
183 file_tags_br->add(s.c_str(), obj);
184 file_tags_br->redraw();} {}
187 Function {search_add_slice_action()} {private return_type void
189 code {for (int i = 1; i <= search_slices_br->size(); i++) {
190 // if (search_slices_br->data(i) == to_voidp(current_slice_id))
193 //sfinx_slice_t *slice = (sfinx_slice_t *)slices_tree->selected()->user_data();
194 //search_slices_br->add(slice->name(), to_voidp(current_slice_id));
195 search_slices_br->redraw();} {}
198 Function {slices_tree_cb(Fl_Widget *, void *)} {private return_type void
200 code {Fl_Toggle_Node *node = slices_tree->selected();
203 if (!Fl::event_clicks())
205 void (*select_slice_action)(void) = (void (*)())(slices_w->user_data());
206 if (select_slice_action) {
208 slices_w->user_data(0);
209 select_slice_action();
213 Function {notes_tree_cb(Fl_Widget *, void *)} {private return_type void
215 code {Fl_Toggle_Node *node = notes_tree->selected();
218 //current_note_id = from_voidp(node->user_data());
219 //current_slice_name = node->label();
220 if (!Fl::event_clicks())
222 void (*select_note_action)(void) = (void (*)())(notes_w->user_data());
223 if (select_note_action) {
224 notes_w->user_data(0);
225 select_note_action();
229 Function {browse_tree_cb(Fl_Widget *, void *)} {open private return_type void
231 code {Fl_Toggle_Node *node = browse_tree->selected();
234 if (!Fl::event_clicks())
236 void (*browse_action)(void) = (void (*)())(browse_w->user_data());
239 browse_w->user_data(0);
244 Function {files_tree_cb(Fl_Widget *, void *)} {private return_type void
246 code {Fl_Toggle_Node *node = files_tree->selected();
251 if (node->can_open()) { // slice
252 obj = ((sfinx_slice_t *)node->user_data())->object();
255 obj = (sfinx_object_t *)node->user_data();
260 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
261 obj->etime.GetDate(eyear, emonth, eday);
262 obj->etime.GetTime(ehour, emin, esec);
263 obj->ctime.GetDate(cyear, cmonth, cday);
264 obj->ctime.GetTime(chour, cmin, csec);
265 sprintf(buf, "Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", cday, cmonth,
266 cyear, chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
267 files_module_status_to->value((type + ": " + obj->name + " | " + buf).c_str());
268 if (!Fl::event_clicks())
270 void (*select_file_action)(void) = (void (*)())(files_module_w->user_data());
271 if (select_file_action) {
272 files_module_w->user_data(0);
273 select_file_action();
277 Function {select_slice_tree_cb(Fl_Widget *, void *)} {private return_type void
279 code {if (!Fl::event_clicks())
281 select_slice_b->do_callback();} {}
284 Function {write_preferences()} {private return_type void
286 code {app->server_name = config_sfinx_server_name_i->value();
287 app->files_module_conf.clear();
288 app->files_module_conf.add(FILES_MODULE_UNSORTED_PATH,
289 config_files_module_unsorted_path_i->value());
290 app->files_module_conf.add(FILES_MODULE_SORTED_TREE_PATH,
291 config_files_module_sorted_path_i->value());
292 app->files_module_conf.add(FILES_MODULE_DESC_FILE_NAME,
293 config_files_module_desc_file_name_i->value());
294 app->files_module_conf.add(FILES_MODULE_DESC_FILE_ENABLE,
295 gen_desc_files_b->value());
296 app->write_preferences();} {}
299 Function {config_tree_cb(Fl_Widget *, void *)} {private return_type void
301 code {static Fl_Group *prev_group;
302 Fl_Toggle_Node *node = config_tree->selected();
304 Fl_Group *gr = *((Fl_Group **)(node->user_data()));
309 //config_tree->unselect();
313 Function {fill_config_tree()} {private return_type void
315 code {config_tree->add_next("Connection", 0, 0, (void *)&config_connection_gr);
316 config_tree->add_next("Files Module", 0, 0, (void *)&config_files_module_gr);
317 config_tree->add_next("Confirmation", 0, 0, (void *)&config_confirmation_gr);
318 config_tree->callback(config_tree_cb);
319 config_tree->edit_on_reselect(0);} {}
322 Function {x11_ui::init()} {open return_type void
326 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
327 F::shutdown(0);} open
328 xywh {171 126 945 365} type Double hide
335 xywh {0 0 67 22} labeltype ENGRAVED_LABEL
338 label {Connect to ...}
339 xywh {0 0 34 22} shortcut 0x80063 labeltype ENGRAVED_LABEL deactivate
342 label {Connect to default server}
343 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
346 label {Disconnect from Sfinx}
347 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
350 label {Connection Info}
351 xywh {20 20 34 22} shortcut 0x80069 labeltype ENGRAVED_LABEL deactivate
355 xywh {30 30 34 22} labeltype ENGRAVED_LABEL deactivate divider
359 callback {app->read_preferences();
360 config_sfinx_server_name_i->value(app->server_name.c_str());
361 preferences_w->show();}
362 xywh {30 30 34 22} shortcut 0x80070 labeltype ENGRAVED_LABEL divider
366 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
368 xywh {20 20 34 22} shortcut 0x80078 labeltype ENGRAVED_LABEL
373 xywh {10 10 67 22} labeltype ENGRAVED_LABEL
377 callback {if (!app->connected()) {
378 fl_message("Not connected to Sfinx Server !");
381 xywh {10 10 34 22} shortcut 0x61 labeltype ENGRAVED_LABEL deactivate
385 callback {if (!app->connected()) {
386 fl_message("Not connected to Sfinx Server !");
389 fill_objects_tree(slices_tree, 1 << SFINX_SLICE_OBJECT, 0, 0); // fluid bugs if any default params exists !
391 xywh {10 10 34 22} shortcut 0x73 labeltype ENGRAVED_LABEL
394 label {Knowledge Module}
395 callback {if (!app->connected()) {
396 fl_message("Not connected to Sfinx Server !");
399 xywh {40 40 34 22} shortcut 0x6b labeltype ENGRAVED_LABEL deactivate
403 callback {if (!app->connected()) {
404 fl_message("Not connected to Sfinx Server !");
407 xywh {40 40 34 22} shortcut 0x74 labeltype ENGRAVED_LABEL deactivate
411 callback {if (!app->connected()) {
412 fl_message("Not connected to Sfinx Server !");
415 xywh {40 40 34 22} shortcut 0x6d labeltype ENGRAVED_LABEL deactivate
419 callback {if (!app->connected()) {
420 fl_message("Not connected to Sfinx Server !");
423 xywh {50 50 34 22} shortcut 0x63 labeltype ENGRAVED_LABEL deactivate
427 callback {if (!app->connected()) {
428 fl_message("Not connected to Sfinx Server !");
431 xywh {40 40 34 22} shortcut 0x65 labeltype ENGRAVED_LABEL deactivate
435 callback {if (!app->connected()) {
436 fl_message("Not connected to Sfinx Server !");
439 if (current_file.tid() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) {
440 if (app->sfinx.send(current_file))
443 fill_objects_tree(files_tree, (1 << SFINX_FILE_OBJECT), 0, 0);
444 files_module_w->show();}
445 xywh {20 20 34 22} shortcut 0x66 labeltype ENGRAVED_LABEL
449 callback {if (!app->connected()) {
450 fl_message("Not connected to Sfinx Server !");
453 // ÒÉÓÕÅÍ ÄÅÒÅ×Ï ÚÁÍÅÔÏË
454 fill_objects_tree(notes_tree, 1 << SFINX_NOTE_OBJECT, 0, 0); // fluid bugs if any default params exists !
456 xywh {30 30 34 22} shortcut 0x6e labeltype ENGRAVED_LABEL
461 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
464 label {Browser && Searcher}
465 callback {if (!app->connected()) {
466 fl_message("Not connected to Sfinx Server !");
469 search_i->take_focus();
471 xywh {30 30 34 22} shortcut 0x62 labeltype ENGRAVED_LABEL
475 callback {if (!app->connected()) {
476 fl_message("Not connected to Sfinx Server !");
479 xywh {30 30 34 22} shortcut 0x72 labeltype ENGRAVED_LABEL deactivate divider
483 callback {if (!app->connected()) {
484 fl_message("Not connected to Sfinx Server !");
487 xywh {40 40 34 22} shortcut 0x40061 labeltype ENGRAVED_LABEL deactivate
490 label {Knowledge Tracer}
491 callback {if (!app->connected()) {
492 fl_message("Not connected to Sfinx Server !");
495 xywh {40 40 34 22} shortcut 0x4006b labeltype ENGRAVED_LABEL deactivate
498 label {Indexing machine}
499 callback {if (!app->connected()) {
500 fl_message("Not connected to Sfinx Server !");
503 xywh {30 30 34 22} shortcut 0x40069 labeltype ENGRAVED_LABEL deactivate
506 label {Check Sfinx DB}
507 callback {if (!app->connected()) {
508 fl_message("Not connected to Sfinx Server !");
511 xywh {40 40 34 22} shortcut 0x40064 labeltype ENGRAVED_LABEL deactivate
515 callback {if (!app->connected()) {
516 fl_message("Not connected to Sfinx Server !");
519 xywh {30 30 34 22} shortcut 0x40062 labeltype ENGRAVED_LABEL deactivate divider
522 label {Clear log window}
523 callback {log_br->clear();}
524 xywh {30 30 34 22} shortcut 0x10063 labeltype ENGRAVED_LABEL
529 xywh {20 20 67 22} labeltype ENGRAVED_LABEL deactivate
533 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
537 xywh {30 30 34 22} shortcut 0xffbe labeltype ENGRAVED_LABEL deactivate divider
541 callback {about_w->show();}
542 xywh {30 30 34 22} shortcut 0x80061 labeltype ENGRAVED_LABEL
546 Fl_Output status_bar_o {
547 tooltip Status xywh {0 347 945 20} box PLASTIC_UP_BOX color 31 deactivate
550 xywh {-1 21 948 326} type Select color 31 labelfont 4 textfont 4
553 Fl_Window preferences_w {
555 xywh {215 308 742 373} type Double color 31 hide
559 callback {preferences_w->hide();}
560 xywh {390 330 112 25} labeltype ENGRAVED_LABEL
564 callback {write_preferences();
565 preferences_w->hide();}
566 xywh {572 330 112 25} labeltype ENGRAVED_LABEL
568 Fl_Scroll prefs_tree_scroll {
569 xywh {10 29 173 283} type VERTICAL_ALWAYS box ENGRAVED_FRAME color 28
570 code0 {config_tree = new Fl_Toggle_Tree(12, 12, prefs_tree_scroll->w() - prefs_tree_scroll->scrollbar.w(), 10);}
571 code1 {fill_config_tree();}
573 Fl_Group config_connection_gr {open
574 xywh {183 19 535 283} box ENGRAVED_FRAME hide
576 Fl_Input config_sfinx_server_name_i {
577 label {Sfinx Server Name}
578 xywh {273 89 375 26} color 29 labeltype ENGRAVED_LABEL align 1
581 label {Minimum Auth Level}
582 xywh {227 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
585 label {User Name && Passsword}
594 label {Minimum Debug Level}
595 xywh {227 230 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
614 label {Warning Level}
626 label {Critical Level}
635 label {Minimum Crypt Level}
636 xywh {476 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
648 Fl_Group config_files_module_gr {
649 xywh {193 29 535 283} box ENGRAVED_FRAME hide
651 Fl_Input config_files_module_unsorted_path_i {
652 label {Unsorted files path on Sfinx server}
653 xywh {283 68 375 26} color 29 labeltype ENGRAVED_LABEL align 1
655 Fl_Input config_files_module_sorted_path_i {
656 label {Sorted file tree path on Sfinx server}
657 xywh {283 128 375 26} color 29 labeltype ENGRAVED_LABEL align 1
659 Fl_Check_Button gen_desc_files_b {
660 label {Generate description files}
661 xywh {209 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
663 Fl_Input config_files_module_desc_file_name_i {
664 label {Description file name}
665 xywh {283 189 375 26} color 29 labeltype ENGRAVED_LABEL align 1
667 Fl_Check_Button process_files_mime_type_b {
668 label {Detect files MIME type}
669 xywh {472 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
672 Fl_Group config_confirmation_gr {
673 xywh {183 19 535 283} box ENGRAVED_FRAME hide
675 Fl_Check_Button exit_confirm_b {
677 xywh {216 45 204 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL deactivate
681 Fl_Window select_slice_w {
682 label {Select Sfinx Slice}
683 xywh {67 62 730 352} type Double color 31 hide modal
687 callback {select_slice_w->hide();}
688 xywh {594 312 112 25} box PLASTIC_UP_BOX labeltype ENGRAVED_LABEL
690 Fl_Button select_slice_b {
692 callback {Fl_Toggle_Node *node = select_slice_tree->selected();
695 void (*select_slice_action)() = (void (*)())(select_slice_w->user_data());
696 if (select_slice_action) {
697 select_slice_w->user_data(0);
698 select_slice_action();
700 select_slice_w->hide();}
701 xywh {16 312 548 25} box PLASTIC_UP_BOX labeltype ENGRAVED_LABEL
703 Fl_Scroll select_slice_tree_scroll {open
704 xywh {15 15 702 280} box ENGRAVED_FRAME color 28
705 code0 {select_slice_tree = new Fl_Toggle_Tree(12, 12, select_slice_tree_scroll->w(), 10);}
706 code1 {select_slice_tree->callback(select_slice_tree_cb);select_slice_tree->user_data((void *)select_slice_tree_scroll);}
707 code2 {select_slice_w->resizable(select_slice_tree_scroll);}
708 code3 {select_slice_tree_scroll->resizable(select_slice_tree);}
709 class Fl_Scroll_Resize
713 label {Sfinx Data} open
714 xywh {200 315 866 370} type Double color 31 hide modal
718 callback {slices_w->hide();}
719 xywh {734 312 112 25} labeltype ENGRAVED_LABEL
723 callback {Fl_Toggle_Node *node = slices_tree->selected();
726 sfinx_slice_t *slice = (sfinx_slice_t *)node->user_data();
727 if (slice->id == 1) // Root Slice can't be deleted
729 // set safe deletion mode
730 slice_deletion_type_ch->value(0);
731 data_deletion_type_ch->value(0);
732 delete_sfinx_slice_to->value(slice->name());
733 delete_slice_w->show();}
734 xywh {454 312 128 25} labeltype ENGRAVED_LABEL
736 Fl_Scroll slices_tree_scroll {
737 xywh {15 13 837 280} box ENGRAVED_FRAME color 28
738 code0 {slices_tree = new Fl_Toggle_Tree(12, 12, slices_tree_scroll->w(), 10);}
739 code1 {slices_tree->callback(slices_tree_cb); slices_tree->user_data((void *)slices_tree_scroll);}
740 code2 {slices_w->resizable(slices_tree_scroll);}
741 code3 {slices_tree_scroll->resizable(slices_tree);}
742 class Fl_Scroll_Resize
746 callback {Fl_Toggle_Node *node = slices_tree->selected();
749 sfinx_slice_t *slice = (sfinx_slice_t *)node->user_data();
750 edit_slice_w->user_data((void *)slice);
751 app->sfinx.send(SFINX_EDIT_SLICE_REQUEST, (u32_t)slice->id);
752 edit_slice_w->label("Edit Sfinx Slice");}
753 xywh {305 312 128 25} labeltype ENGRAVED_LABEL
755 Fl_Output slices_status_to {
756 xywh {0 349 866 21} box PLASTIC_UP_BOX color 31 deactivate
760 callback {Fl_Toggle_Node *node = slices_tree->selected();
762 fl_alert("Please select slice connection point !");
765 edit_slice_w->user_data(0); // new slice
766 slice_name_i->value(0);
767 slice_directory_i->value(0);
768 slice_name_i->take_focus();
769 slice_description_i->value(0);
770 sfinx_slice_t *slice = (sfinx_slice_t *)slices_tree->selected()->user_data();
771 edit_slice_to->value(string(string("Parent slice: ") + slice->name()).c_str());
772 edit_slice_w->label("New Sfinx Slice");
773 edit_slice_w->show();}
774 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
778 callback {Fl_Toggle_Node *node = slices_tree->selected();
781 sfinx_slice_t *slice = (sfinx_slice_t *)node->user_data();
782 if (slice->id == 1) // root slice can't be relinked
784 fill_objects_tree(select_slice_tree, SFINX_SLICE_OBJECT, slice, 0);
785 select_slice_w->user_data((void *)relink_slice_action);
786 select_slice_w->show();}
787 xywh {155 312 128 25} labeltype ENGRAVED_LABEL
791 callback {search_mi->do_callback(0, (void *)0);}
792 xywh {600 312 119 25} labeltype ENGRAVED_LABEL
795 Fl_Window edit_slice_w {
796 label {Edit Sfinx Slice}
797 xywh {276 319 595 330} type Double color 31 hide modal
799 Fl_Input slice_name_i {
801 xywh {47 35 496 26} color 29 labeltype ENGRAVED_LABEL align 1
803 Fl_Input slice_directory_i {
804 label {Slice Directory}
805 xywh {47 93 496 26} color 29 labeltype ENGRAVED_LABEL align 1
807 Fl_Input slice_description_i {
808 label {Slice Description}
809 xywh {34 158 523 89} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
811 Fl_Return_Button {} {
813 callback {if (!slice_name_i->size()) {
814 fl_message("Missing slice name !");
817 sfinx_slice_t *eslice = (sfinx_slice_t *)edit_slice_w->user_data();
820 slice.tid(SFINX_EDIT_SLICE);
821 slice.id = eslice->id; // edited slice id
822 slice.parent_id = eslice->parent_id;
824 slice.tid(SFINX_NEW_SLICE);
825 sfinx_slice_t *s = (sfinx_slice_t *)(slices_tree->selected()->user_data());
826 slice.parent_id = s->id; // parent id for new slice
828 slice.name(slice_name_i->value());
829 slice.directory(slice_directory_i->value());
830 slice.description(slice_description_i->value());
831 app->sfinx.send(slice);
832 edit_slice_w->hide();
833 fill_objects_tree(slices_tree, 1 << SFINX_SLICE_OBJECT, 0, 1); // force refresh}
834 xywh {111 270 112 25} labeltype ENGRAVED_LABEL
838 callback {edit_slice_w->hide();}
839 xywh {359 270 112 25} labeltype ENGRAVED_LABEL
841 Fl_Output edit_slice_to {
842 xywh {0 312 598 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
845 Fl_Window delete_slice_w {
846 label {Delete Sfinx Slice}
847 xywh {350 43 388 223} type Double color 31 hide modal
851 callback {delete_slice_w->hide();}
852 xywh {238 175 112 25} labeltype ENGRAVED_LABEL
856 callback {// need to confirm deletion ?!
857 bool recursivly = slice_deletion_type_ch->value();
858 sfinx_slice_t *slice = (sfinx_slice_t *)slices_tree->selected()->user_data();
859 app->sfinx.send(data_deletion_type_ch->value() ?
860 (recursivly ? SFINX_DELETE_SLICE_ASSOC_DATA_RECURSIVLY : SFINX_DELETE_SLICE_ASSOC_DATA) :
861 (recursivly ? SFINX_DELETE_SLICE_MARK_DATA_UNSORTED_RECURSIVLY : SFINX_DELETE_SLICE_MARK_DATA_UNSORTED),
863 app->sfinx.send(recursivly ? SFINX_DELETE_SLICE_RECURSIVLY : SFINX_DELETE_SLICE_WITH_REATTACH,
865 delete_slice_w->hide();
866 fill_objects_tree(slices_tree, 1 << SFINX_SLICE_OBJECT, 0, 1); // force refresh}
867 xywh {39 175 112 25} labeltype ENGRAVED_LABEL
869 Fl_Output delete_sfinx_slice_to {
870 label {Please confirm deletion of the slice}
871 xywh {35 31 330 26} box ENGRAVED_FRAME color 29 labeltype ENGRAVED_LABEL align 1
873 Fl_Choice slice_deletion_type_ch {
874 label {Slice && Data Deletion Action}
875 xywh {73 82 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 1
878 label {Attach subslices to parent}
882 label {Delete all subslices recursivly}
886 Fl_Choice data_deletion_type_ch {
887 label {Associated Data Deletion Action}
888 xywh {73 132 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 1
891 label {Mark all data 'Unsorted'}
895 label {Delete all data}
900 Fl_Window progress_w {
902 xywh {286 302 464 98} type Double hide
904 Fl_Progress progress_bar {
906 xywh {22 46 422 27} box PLASTIC_DOWN_BOX selection_color 2
909 label {Doing some work ...}
910 xywh {66 10 330 25} box FLAT_BOX labeltype ENGRAVED_LABEL
913 Fl_Window files_module_w {
914 label {Files Module} open
915 xywh {87 152 730 370} type Double color 31 hide
919 callback {files_module_w->hide();}
920 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
922 Fl_Output files_module_status_to {
923 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
925 Fl_Button classify_file_b {
927 callback {int n = files_module_tree_br->value();
930 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
932 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
934 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
935 file->etime.GetDate(eyear, emonth, eday);
936 file->etime.GetTime(ehour, emin, esec);
937 file->ctime.GetDate(cyear, cmonth, cday);
938 file->ctime.GetTime(chour, cmin, csec);
939 sprintf(buf, "%llu bytes | Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", file->fsize, cday, cmonth,
940 cyear, chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
941 string t = "URL: " + path + current_file.name + "/" + file->name + " | " + file->mimetype + " | Size: " + buf;
942 classify_file_to->value(t.c_str());
943 file_title_i->value(0);
944 file_name_i->value(file->name.c_str());
945 // save orig file name
946 file->orig_name = file->name;
947 file->tid(SFINX_FILES_MODULE_CLASSIFY_REQUEST); // new file
948 file_title_i->take_focus();
949 file_authority_i->value(0);
950 file_description_i->value(0);
951 file_comments_i->value(0);
952 sorted_location_b->value(1);
953 file_compress_b->value(1);
954 file_gen_csum_b->value(1);
955 file_mtag_b->label("Main Slice (Not Set)");
956 file_mtag_b->user_data(0); // ÔÕÔÁ ÈÒÁÎÉÔÓÑ mtag
957 file_tags_br->clear();
958 classify_file_w->user_data((void *)file);
959 classify_file_w->label("Classify File");
960 classify_file_w->show();}
961 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
965 callback {Fl_Toggle_Node *node = files_tree->selected();
966 if (!node || node->can_open()) {
967 fl_alert("Please select file to edit !");
970 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
971 if (obj->type != SFINX_FILE_OBJECT)
973 sfinx_file_t file(SFINX_FILES_MODULE_EDIT_REQUEST);
975 app->sfinx.send(file);}
976 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
978 Fl_Browser files_module_tree_br {
979 callback {if (!Fl::event_clicks())
981 sfinx_files_vector_t *tree = (sfinx_files_vector_t *) files_module_tree_br->user_data();
982 int n = files_module_tree_br->value();
983 if (tree->files[n - 1]->is_directory) { // ÀÚÅÒ ÓÍÅÎÉÌ ÄÉÒÅËÔÏÒÉÀ
984 current_file.id = tree->files[n - 1]->id;
985 current_file.mtag.id = tree->files[n - 1]->mtag.id;
986 current_file.name += ('/' + tree->files[n - 1]->name);
987 app->sfinx.send(current_file);
989 if (!(tree->files[n - 1]->id)) // classify file
990 classify_file_b->do_callback();
992 xywh {7 45 716 255} type Multi color 31
993 code0 {static int widths[] = { 10, 450, 200, 200, 0};}
994 code1 {files_module_tree_br->column_widths(widths);}
998 callback {if (current_file.tid() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) { // unsorted tree
999 int n = files_module_tree_br->value();
1002 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
1003 string path; // sure ?
1004 string message = "Deleting ";
1005 if (file->is_directory)
1006 message += "directory";
1009 message += (" \\'" + file->name + "\\'. Are you sure ?");
1010 if (fl_choice(message.c_str(), "Yes", "No", 0L))
1012 file->tid(SFINX_FILES_MODULE_UNSORTED_DELETE);
1013 app->sfinx.send(file); // check for errors ?
1014 app->sfinx.send(current_file);
1015 } else { // sorted tree
1016 Fl_Toggle_Node *node = files_tree->selected();
1017 if (!node || node->can_open())
1019 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1020 string message = "Delete or Unsort \\'" + obj->name + "\\' ?";
1021 int res = fl_choice(message.c_str(), "Cancel", "Unsort", "Delete");
1024 file.mtag.slice_id = obj->slice_id;
1027 if (res == 2) // delete
1028 file.tid(SFINX_FILES_MODULE_SORTED_UNLINK);
1030 file.tid(SFINX_FILES_MODULE_UNSORT);
1031 app->sfinx.send(file);
1032 fill_objects_tree(files_tree, (1 << SFINX_FILE_OBJECT), 0, 1); // fluid bugs if any default params exists !
1035 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
1037 Fl_Button select_files_tree_b {
1039 callback {current_file.name.clear();
1040 current_file.orig_name.clear();
1041 if (select_files_tree_b->user_data()) {
1042 current_file.tid(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);
1043 current_file.id = 0;
1044 select_files_tree_b->user_data(0);
1045 app->sfinx.send(current_file);
1047 select_files_tree_b->user_data((void *)1);
1048 select_files_tree_b->label("Show Unsorted");
1049 select_files_tree_b->redraw();
1050 current_file.tid(0);
1051 files_module_status_to->value("Sorted Files Tree");
1052 current_file.id = 1; // root id
1053 files_module_tree_br->hide();
1054 files_tree_scroll->resize(files_tree_scroll->x(), files_tree_scroll->y(), files_module_tree_br->w(), files_module_tree_br->h());
1055 files_module_w->resizable(files_tree_scroll);
1056 fill_objects_tree(files_tree, 1 << SFINX_FILE_OBJECT, 0, 0); // fluid bugs if any default params exists !
1057 files_tree_scroll->show();
1059 xywh {562 10 128 25} labeltype ENGRAVED_LABEL
1063 callback {const char *p = strrchr(current_file.name.c_str(), '/');
1065 if (!current_file.name.size())
1067 current_file.name.clear();
1071 strncat(path, current_file.name.c_str(), p - current_file.name.c_str());
1072 current_file.name = path;
1073 current_file.id = current_file.mtag.id;
1075 app->sfinx.send(current_file);}
1076 xywh {35 10 112 25} labeltype ENGRAVED_LABEL
1080 callback {app->sfinx.send(current_file);}
1081 xywh {166 10 112 25} labeltype ENGRAVED_LABEL
1085 callback {//for (int i = 1; i <= files_module_tree_br->size(); i++)
1086 // files_module_tree_br->select(i);}
1087 xywh {295 10 112 25} labeltype ENGRAVED_LABEL
1090 label {Unselect All}
1091 callback {files_module_tree_br->deselect();}
1092 xywh {428 10 112 25} labeltype ENGRAVED_LABEL
1094 Fl_Scroll files_tree_scroll {
1095 xywh {7 45 716 255} type BOTH_ALWAYS box ENGRAVED_FRAME color 28 hide
1096 code0 {files_tree = new Fl_Toggle_Tree(12, 12, files_tree_scroll->w(), 10);}
1097 code1 {files_tree->callback(files_tree_cb); files_tree->user_data((void *)files_tree_scroll);}
1098 code2 {files_module_w->resizable(files_tree_scroll);}
1099 code3 {files_tree_scroll->resizable(files_tree);files_tree_scroll->resize_chld = false;}
1100 class Fl_Scroll_Resize
1103 Fl_Window classify_file_w {
1104 label {Classify File}
1105 xywh {84 298 1020 515} type Double color 31 hide modal
1109 callback {classify_file_w->hide();}
1110 xywh {612 454 112 25} labeltype ENGRAVED_LABEL
1112 Fl_Input file_title_i {
1114 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1116 Fl_Input file_authority_i {
1118 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1120 Fl_Input file_description_i {
1122 xywh {549 78 447 101} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1124 Fl_Input file_comments_i {
1126 xywh {582 220 416 212} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1128 Fl_Output classify_file_to {
1129 xywh {0 497 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
1131 Fl_Return_Button {} {
1133 callback {if (!file_mtag_b->user_data()) {
1134 fl_alert("You have to select Main Slice for file !");
1137 if (!file_name_i->size()) {
1138 fl_alert("File must have some name !");
1141 sfinx_file_t *file = (sfinx_file_t *)classify_file_w->user_data();
1142 file->name = file_name_i->value();
1143 file->title = file_title_i->value();
1144 file->authority = file_authority_i->value();
1145 file->description = file_description_i->value();
1146 file->comments = file_comments_i->value();
1147 file->sorted_location = sorted_location_b->value();
1148 file->store_compressed = file_compress_b->value();
1149 file->generate_csum = file_gen_csum_b->value();
1150 sfinx_object_t *obj = (sfinx_object_t *)file_mtag_b->user_data();
1151 file->mtag.id = obj->id;
1152 file->mtag.type = obj->type;
1153 file->mtag.slice_id = obj->slice_id;
1154 file_mtag_b->user_data(0);
1156 for (int i = 1; i <= file_tags_br->size(); i++) {
1157 obj = (sfinx_object_t *)file_tags_br->data(i);
1158 file->tags.push_back(*obj);
1159 file_tags_br->data(i, 0);
1161 app->sfinx.send(file);}
1162 xywh {243 454 112 25} labeltype ENGRAVED_LABEL
1164 Fl_Check_Button sorted_location_b {
1165 label {Sorted Location}
1166 xywh {15 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1168 Fl_Check_Button file_crypt_b {
1170 xywh {15 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
1172 Fl_Check_Button file_compress_b {
1173 label {Store compressed}
1174 xywh {274 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1177 xywh {13 205 552 227} box ENGRAVED_FRAME
1179 Fl_Button file_mtag_b {
1180 label {Main Slice (Not Set)}
1181 callback {fill_objects_tree(select_slice_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_FILE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 0); // fluid bugs if any default params exists !
1182 select_slice_w->user_data((void *)select_file_mtag_action);
1183 select_slice_w->show();}
1184 tooltip {File Main Slice} xywh {45 226 489 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1186 Fl_Browser file_tags_br {
1187 label {Additional Slices}
1188 xywh {26 275 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1190 Fl_Button file_add_tag_b {
1192 callback {fill_objects_tree(select_slice_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_FILE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 0); // fluid bugs if any default params exists !
1193 select_slice_w->user_data((void *)select_file_atag_action);
1194 select_slice_w->show();}
1195 xywh {82 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1197 Fl_Button file_remove_tag_b {
1198 label {Remove Slice}
1199 callback {for (int i = file_tags_br->size(); i >= 1; i--) {
1200 if (file_tags_br->selected(i))
1201 file_tags_br->remove(i);
1203 xywh {358 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1205 Fl_Input file_name_i {
1207 xywh {549 26 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1209 Fl_Check_Button file_gen_csum_b {
1210 label {Generate CSUM}
1211 xywh {274 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1215 label {Notes Module} open
1216 xywh {272 69 730 370} type Double color 31 hide
1220 callback {notes_w->hide();}
1221 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
1223 Fl_Output notes_module_status_to {
1224 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
1228 callback {Fl_Toggle_Node *node = notes_tree->selected();
1230 fl_alert("Please select slice connection point !");
1233 sfinx_note_t *note = new sfinx_note_t(SFINX_NOTES_MODULE_ADD);
1234 edit_note_w->user_data((void *)note);
1235 sfinx_object_t *obj;
1236 if (node->can_open()) // slice
1237 obj = ((sfinx_slice_t *)node->user_data())->object();
1239 obj = (sfinx_object_t *) node->user_data();
1240 note_mtag_b->user_data(obj);
1241 note_mtag_b->copy_label((obj->name + " [ " + obj->description + " ]").c_str());
1242 note_mtag_b->redraw();
1243 note_name_i->value(0);
1244 note_url_i->value(0);
1245 note_text_i->value(0);
1246 note_name_i->take_focus();
1247 edit_note_w->label("New Note");
1248 edit_note_w->show();}
1249 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
1253 callback {Fl_Toggle_Node *node = notes_tree->selected();
1254 if (!node || node->can_open()) {
1255 fl_alert("Please select note to edit !");
1258 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1259 if (obj->type != SFINX_NOTE_OBJECT)
1261 sfinx_note_t note(SFINX_NOTES_MODULE_EDIT_REQUEST);
1263 app->sfinx.send(note);}
1264 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
1266 Fl_Scroll notes_tree_scroll {
1267 xywh {13 10 705 289} box ENGRAVED_FRAME color 28
1268 code0 {notes_tree = new Fl_Toggle_Tree(12, 12, notes_tree_scroll->w(), 10);}
1269 code1 {notes_tree->callback(notes_tree_cb); notes_tree->user_data((void *)notes_tree_scroll);}
1270 code2 {notes_w->resizable(notes_tree_scroll);}
1271 code3 {notes_tree_scroll->resizable(notes_tree);}
1272 class Fl_Scroll_Resize
1276 callback {Fl_Toggle_Node *node = notes_tree->selected();
1277 if (!node || node->can_open())
1279 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1280 delete_sfinx_note_to->value(obj->name.c_str());
1281 delete_note_w->user_data(obj);
1282 delete_note_w->show();}
1283 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
1286 Fl_Window edit_note_w {
1288 xywh {212 174 1020 385} type Double color 31 hide modal
1292 callback {edit_note_w->hide();}
1293 xywh {648 321 112 25} labeltype ENGRAVED_LABEL
1295 Fl_Input note_name_i {
1297 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1299 Fl_Input note_url_i {
1301 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1303 Fl_Input note_text_i {
1305 xywh {16 141 496 158} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1307 Fl_Output edit_note_to {
1308 xywh {0 364 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
1310 Fl_Return_Button {} {
1312 callback {if (!note_mtag_b->user_data()) {
1313 fl_alert("You have to select Main Object for note !");
1316 if (!note_name_i->size()) {
1317 fl_alert("Note must have some name !");
1320 if (!note_text_i->size()) {
1321 fl_alert("Note must have some text !");
1324 sfinx_note_t *note = (sfinx_note_t *)edit_note_w->user_data();
1325 note->name = note_name_i->value();
1326 note->url = note_url_i->value();
1327 note->text = note_text_i->value();
1328 sfinx_object_t *obj = (sfinx_object_t *)note_mtag_b->user_data();
1329 note->mtag.id = obj->id;
1330 note->mtag.type = obj->type;
1331 note->mtag.slice_id = obj->slice_id;
1332 note_mtag_b->user_data(0);
1334 for (int i = 1; i <= note_tags_br->size(); i++) {
1335 obj = (sfinx_object_t *)note_tags_br->data(i);
1336 note->tags.push_back(*obj);
1337 note_tags_br->data(i, 0);
1339 app->sfinx.send(note);
1341 edit_note_w->user_data(0);}
1342 xywh {279 321 112 25} labeltype ENGRAVED_LABEL
1345 xywh {535 72 467 227} box ENGRAVED_FRAME
1347 Fl_Button note_mtag_b {
1348 label {Main Note Tag (Not Set)}
1349 callback {fill_objects_tree(select_slice_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_FILE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 0); // fluid bugs if any default params exists !
1350 slices_w->user_data((void *)select_note_mtag_action);
1352 tooltip {Note Main Tag} xywh {594 93 348 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1354 Fl_Browser note_tags_br {
1355 label {Additional Note Tags}
1356 xywh {559 146 420 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1358 Fl_Button note_add_tag_b {
1360 callback {fill_objects_tree(select_slice_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_FILE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 0); // fluid bugs if any default params exists !
1361 slices_w->user_data((void *)select_note_atag_action);
1363 xywh {584 258 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1365 Fl_Button note_remove_tag_b {
1367 callback {for (int i = note_tags_br->size(); i >= 1; i--) {
1368 if (note_tags_br->selected(i))
1369 note_tags_br->remove(i);
1371 xywh {811 258 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1373 Fl_Choice note_secured_ch {
1374 label {Secure Level}
1375 xywh {536 27 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
1382 label {Crypted Text}
1387 Fl_Window delete_note_w {
1389 xywh {44 182 388 168} type Double color 31 hide modal
1393 callback {delete_note_w->hide();}
1394 xywh {239 122 112 25} labeltype ENGRAVED_LABEL
1398 callback {sfinx_object_t *obj = (sfinx_object_t *) delete_note_w->user_data();
1399 sfinx_note_t note(note_deletion_type_ch->value() ? SFINX_NOTES_MODULE_UNLINK : SFINX_NOTES_MODULE_UNSORT);
1401 note.mtag.slice_id = obj->slice_id;
1402 app->sfinx.send(note);
1403 delete_note_w->user_data(0);
1404 delete_note_w->hide();
1405 fill_objects_tree(notes_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 1); // force refresh}
1406 xywh {40 122 112 25} labeltype ENGRAVED_LABEL
1408 Fl_Output delete_sfinx_note_to {
1409 label {Please confirm deletion of the note}
1410 xywh {31 26 330 26} box ENGRAVED_FRAME color 29 labeltype ENGRAVED_LABEL align 1
1412 Fl_Choice note_deletion_type_ch {
1413 label {Associated Data Deletion Action}
1414 xywh {74 80 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 1
1417 label {Mark all data 'Unsorted'}
1421 label {Delete all data}
1426 Fl_Window search_browser_w {
1427 label {Search Browser}
1428 xywh {217 305 854 476} type Double color 31 hide resizable modal
1432 callback {search_browser_w->hide();}
1433 xywh {638 449 187 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1435 Fl_Browser search_browser_br {
1436 xywh {4 4 846 439} type Hold box GTK_THIN_UP_BOX color 44 resizable
1439 label {Previous Page}
1440 xywh {25 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1444 xywh {231 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1446 Fl_Choice goto_page_ch {
1447 label {Current Page }
1448 xywh {531 450 72 20} box PLASTIC_THIN_UP_BOX down_box PLASTIC_THIN_UP_BOX color 44 labeltype ENGRAVED_LABEL
1451 Fl_Window browse_w {
1453 xywh {272 69 730 370} type Double color 31 hide resizable modal
1457 callback {browse_w->hide();}
1458 xywh {596 312 112 25} labeltype ENGRAVED_LABEL
1460 Fl_Output browse_status_to {
1461 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
1465 callback {/*Fl_Toggle_Node *node = browse_tree->selected();
1466 if (!node || node->can_open()) {
1467 fl_alert("Please select object to edit !");
1470 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1471 if (obj->type != SFINX_NOTE_OBJECT)
1473 sfinx_note_t note(SFINX_NOTES_MODULE_EDIT_REQUEST);
1475 app->sfinx.send(note);*/}
1476 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
1478 Fl_Scroll browse_scroll {
1479 xywh {13 10 705 289} box ENGRAVED_FRAME color 28
1480 code0 {browse_tree = new Fl_Toggle_Tree(12, 12, browse_scroll->w(), 10);}
1481 code1 {browse_tree->callback(browse_tree_cb); browse_tree->user_data((void *)browse_scroll);}
1482 code2 {browse_w->resizable(browse_scroll);}
1483 code3 {browse_scroll->resizable(browse_tree);}
1484 class Fl_Scroll_Resize
1488 callback {/*Fl_Toggle_Node *node = notes_tree->selected();
1489 if (!node || node->can_open())
1491 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1492 delete_sfinx_note_to->value(obj->name.c_str());
1493 delete_note_w->user_data(obj);
1494 delete_note_w->show();*/}
1495 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
1499 xywh {24 312 112 25} labeltype ENGRAVED_LABEL
1502 Fl_Window search_w {
1503 label {Search & Browse}
1504 xywh {191 209 749 389} type Double color 31 hide modal
1508 callback {search_w->hide();}
1509 xywh {182 347 363 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1511 Fl_Return_Button {} {
1513 callback {sfinx_search_query_t query;
1514 query.pattern = search_i->value();
1515 if (search_in_files_b->value())
1516 query.add_area(SFINX_SEARCH_IN_FILES);
1517 // add restrictions ...
1518 app->sfinx.send(query);}
1519 xywh {539 48 163 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1521 Fl_Check_Button search_in_files_b {
1522 label {Search in Files}
1523 xywh {48 96 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
1526 xywh {87 141 561 189} box ROUNDED_FRAME
1528 Fl_Browser search_slices_br {
1529 label {Restrict Search by Slices}
1530 xywh {105 173 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1532 Fl_Button search_add_slice_b {
1534 callback {app->refresh_slices();
1535 slices_w->user_data((void *)search_add_slice_action);
1537 xywh {161 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1540 label {Remove Slice}
1541 callback {for (int i = search_slices_br->size(); i >= 1; i--) {
1542 if (search_slices_br->selected(i))
1543 search_slices_br->remove(i);
1545 xywh {437 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1548 label {Search for ...}
1549 xywh {46 47 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1553 callback {fill_objects_tree(browse_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_FILE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 0); // fluid bugs if any default params exists !
1555 xywh {539 96 163 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1559 xywh {357 229 374 154} type Double hide
1563 callback {about_w->hide();}
1564 xywh {72 122 226 20} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1567 image {../docs/sfinx.jpg} xywh {10 9 130 101}
1571 xywh {203 6 99 33} labeltype EMBOSSED_LABEL labelfont 9 labelsize 32
1574 label {Personal knowledge manager}
1575 xywh {150 40 214 22} labeltype EMBOSSED_LABEL labelcolor 64
1578 label {Copyright (C) 2007 Rus V. Brushkoff}
1579 xywh {150 58 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1582 label {Email: Rus@@Sfinx.Od.UA}
1583 xywh {150 75 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1586 label {http://sfinx.od.ua/index.php?id=sfinx}
1587 xywh {150 93 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1590 code {main_w->show();} {}
1593 Function {x11_ui::edit_slice(sfinx_slice_t *slice)} {return_type void
1597 slice_name_i->value(slice->name());
1598 slice_directory_i->value(slice->directory());
1599 slice_name_i->take_focus();
1600 slice_description_i->value(slice->description());
1601 string status_line = "Parent slice: ";
1602 status_line += slice->parent_name();
1603 int cyear, cmonth, cday, eyear, emonth, eday, chour, cmin, csec, ehour, emin, esec;
1604 slice->ctime.GetDate(cyear, cmonth, cday);
1605 slice->etime.GetDate(eyear, emonth, eday);
1606 slice->ctime.GetTime(chour, cmin, csec);
1607 slice->etime.GetTime(ehour, emin, esec);
1609 sprintf(buf, " | Created at %02d/%02d/%02d %02d:%02d:%02d, Modified at %02d/%02d/%02d %02d:%02d:%02d", cyear, cmonth, cday, chour, cmin,
1610 csec, eyear, emonth, eday, ehour, emin, esec);
1612 edit_slice_to->value(status_line.c_str());
1613 edit_slice_w->show();
1617 Function {x11_ui::notes_module_edit(sfinx_note_t *n)} {return_type void
1620 sfinx_note_t *note = new sfinx_note_t;
1622 note->tid(SFINX_NOTES_MODULE_EDIT);
1623 edit_note_w->user_data((void *)note);
1625 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
1626 note->etime.GetDate(eyear, emonth, eday);
1627 note->etime.GetTime(ehour, emin, esec);
1628 note->ctime.GetDate(cyear, cmonth, cday);
1629 note->ctime.GetTime(chour, cmin, csec);
1630 sprintf(buf, "Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", cday, cmonth, cyear,
1631 chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
1632 edit_note_to->value(buf);
1633 note_name_i->value(note->name.c_str());
1634 note_name_i->take_focus();
1635 note_url_i->value(note->url.c_str());
1636 note_text_i->value(note->text.c_str());
1638 note_mtag_b->user_data(&(note->mtag));
1639 note_mtag_b->copy_label((note->mtag.name + " [ " + note->mtag.description + " ]").c_str());
1640 note_mtag_b->redraw();
1642 note_tags_br->clear();
1643 for (u32_t i = 0; i < note->tags.size(); i++) {
1644 string s = note->tags[i].name + " [ " + note->tags[i].description + " ]";
1645 note_tags_br->add(s.c_str(), &(note->tags[i]));
1647 edit_note_w->label("Edit Note");
1648 edit_note_w->show();
1652 Function {x11_ui::notes_module_reply(sfinx_string_t *classify_error)} {return_type void
1655 if (classify_error->size() == 1) {
1656 ::fill_objects_tree(notes_tree, 1 << SFINX_NOTE_OBJECT, 0, 1); // fluid bugs if any default params exists !
1657 edit_note_w->hide();
1659 fl_alert(classify_error->c_str());
1663 Function {x11_ui::files_module_edit_reply(sfinx_string_t *classify_error)} {return_type void
1666 if (classify_error->size() == 1) {
1667 if (current_file.tid() != SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
1668 ::fill_objects_tree(files_tree, (1 << SFINX_FILE_OBJECT), 0, 1); // fluid bugs if any default params exists !
1670 app->sfinx.send(current_file);
1671 classify_file_w->hide();
1673 fl_alert(classify_error->c_str());
1677 Function {x11_ui::files_module_edit(sfinx_file_t *f)} {return_type void
1680 static sfinx_file_t file;
1683 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
1684 file.etime.GetDate(eyear, emonth, eday);
1685 file.etime.GetTime(ehour, emin, esec);
1686 file.ctime.GetDate(cyear, cmonth, cday);
1687 file.ctime.GetTime(chour, cmin, csec);
1688 sprintf(buf, "%llu bytes | Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", file.fsize, cday, cmonth, cyear,
1689 chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
1691 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, path);
1692 string t = "URL: " + path + current_file.name + "/" + file.name + " | " + file.mimetype + " | Size: " + buf;
1693 classify_file_to->value(t.c_str());
1694 file_title_i->value(file.title.c_str());
1695 file_name_i->value(file.name.c_str());
1696 // save orig file name
1697 file.orig_name = file.name;
1698 file.tid(SFINX_FILES_MODULE_EDIT_FILE); // edit file
1699 file_title_i->take_focus();
1700 file_authority_i->value(file.authority.c_str());
1701 file_description_i->value(file.description.c_str());
1702 file_comments_i->value(file.comments.c_str());
1703 sorted_location_b->value(file.sorted_location);
1704 file_compress_b->value(file.store_compressed);
1705 file_gen_csum_b->value(file.generate_csum);
1706 file_mtag_b->copy_label((file.mtag.name + " [ " + file.mtag.description + " ]").c_str());
1707 file_mtag_b->user_data(&file.mtag);
1708 file_tags_br->clear();
1709 for (u32_t i = 0; i < file.tags.size(); i++) {
1710 string s = file.tags[i].name + " [ " + file.tags[i].description + " ]";
1711 file_tags_br->add(s.c_str(), &(file.tags[i]));
1713 classify_file_w->user_data((void *)&file);
1714 classify_file_w->label("Edit File");
1715 classify_file_w->show();
1719 Function {x11_ui::search_browser(sfinx_pair_vector_t *r)} {open return_type void
1722 search_browser_br->clear();
1724 fl_message("Sfinx has no data for this query");
1728 goto_page_ch->clear();
1729 /*for (u32_t i = 1; i < 50; i++) {
1731 sprintf(b, "%d", i);
1732 goto_page_ch->add(b, 0, 0, (void *)i);
1733 // Fl_Menu_Item *item = (Fl_Menu_Item *)(goto_page_ch->menu() + n);
1734 // item->color(FL_GREEN);
1736 goto_page_ch->value(0);
1737 //goto_page_ch->selection_color(FL_GREEN);
1740 for (u32_t i = 0; i < r->len(); i++) {
1741 sfinx_pair_t *p = r->find(i);
1745 if (!p->get(i, &el))
1749 app->prepare_search_info(el, inf);
1750 string::size_type pos = 0, found;
1751 while ((found = inf.find('\\n', pos)) != string::npos) {
1752 string line(inf, pos, found - pos);
1753 search_browser_br->add(line.c_str()); // add obj pointer for clicks ...
1756 search_browser_br->add("@-");
1758 search_browser_w->show();
1762 Function {x11_ui::fill_objects_tree()} {return_type void
1765 Fl_Toggle_Tree *tree = fill_tree;
1766 u32_t mask = fill_tree_mask;
1769 mask = SFINX_SLICE_OBJECT;
1772 tree->draw_lines(1);
1773 tree->alternate_color(FL_LIGHT2);
1774 tree->trim_color(FL_LIGHT1);
1775 tree->edit_on_reselect(0);
1776 sfinx_slice_t *slice;
1777 Fl_Toggle_Node *node;
1778 u32_t max_name_len = 0;
1779 for (u32_t i = 0; i < app->slices.len(); i++) {
1780 slice = app->slices.get(i);
1781 if (slice == fill_tree_except)
1783 //debug("slice name - %s, id - %lld, parent_id - %lld", slice->name(), slice->id, slice->parent_id);
1784 string name = slice->name() + string(" [ ") +
1785 slice->description() + string(" ]");
1786 // replace \\n with spaces
1787 string filt_elems( "\\n");
1788 string::size_type pos = 0;
1789 while (( pos = name.find_first_of(filt_elems, pos)) != string::npos)
1790 name.replace(pos, 1, string(" "));
1791 if (name.size() > max_name_len)
1792 max_name_len = name.size();
1793 if (!slice->parent_id) {
1794 node = tree->add_sub((char *)name.c_str(), 1, &slice_pixmap, to_voidp(slice));
1795 if (fill_tree_mask & ((1 << SFINX_NOTE_OBJECT) | (1 << SFINX_FILE_OBJECT))) {
1798 for (u32_t x = 0; x < slice->objs.size(); x++) {
1799 switch (slice->objs[x].type) {
1800 case SFINX_NOTE_OBJECT:
1801 if (fill_tree_mask & (1 << SFINX_NOTE_OBJECT))
1802 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, ¬e_pixmap,
1803 to_voidp(&(slice->objs[x])));
1805 case SFINX_FILE_OBJECT:
1806 if (fill_tree_mask & (1 << SFINX_FILE_OBJECT))
1807 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, &file_pixmap,
1808 to_voidp(&(slice->objs[x])));
1811 debug("unsupported fill tree type %d", slice->objs[x].type);
1814 tree->traverse_up();
1818 node = tree->traverse_start();
1820 sfinx_slice_t *s = (sfinx_slice_t *) node->user_data();
1821 if (s->id == slice->parent_id)
1823 node = tree->traverse_forward();
1827 node = tree->add_sub((char *)name.c_str(), 1, &slice_pixmap, to_voidp(slice));
1828 if (fill_tree_mask & ((1 << SFINX_NOTE_OBJECT) | (1 << SFINX_FILE_OBJECT))) {
1831 for (u32_t x = 0; x < slice->objs.size(); x++) {
1832 switch (slice->objs[x].type) {
1833 case SFINX_NOTE_OBJECT:
1834 if (fill_tree_mask & (1 << SFINX_NOTE_OBJECT))
1835 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, ¬e_pixmap,
1836 to_voidp(&(slice->objs[x])));
1838 case SFINX_FILE_OBJECT:
1839 if (fill_tree_mask & (1 << SFINX_FILE_OBJECT))
1840 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, &file_pixmap,
1841 to_voidp(&(slice->objs[x])));
1844 debug("unsupported fill tree type %d", slice->objs[x].type);
1847 tree->traverse_up();
1850 } // node not found - just ignore
1853 s32_t width = max_name_len * 8;
1854 // need to count depth for width update
1855 Fl_Scroll_Resize *tree_scroll = (Fl_Scroll_Resize *) tree->user_data();
1856 if (!tree_scroll) // he, forgot to set ;)
1858 tree->resize(tree->x(), tree->y(), width > tree_scroll->w() ? width : tree_scroll->w(), tree->h());
1860 //tree_scroll->redraw();
1861 // try to select previous node
1862 //node = slices_tree->find(to_voidp(current_slice_id));
1864 // slices_tree->select_range(node, node);
1868 Function {x11_ui::fill_unsorted_files_tree(sfinx_files_vector_t *tree_)} {return_type void
1871 static sfinx_files_vector_t tree;
1873 files_module_tree_br->user_data((void *)&tree);
1874 files_module_tree_br->clear();
1876 u32_t files = 0, dirs = 0;
1877 // set parent dir id
1878 if (tree.files.size())
1879 current_file.mtag.id = tree.files[0]->compressed_fsize;
1880 for (u32_t i = 0; i < tree.files.size(); i++) {
1881 if (tree.files[i]->is_directory)
1882 strcpy(buf, "\\t@b@.");
1885 strncat(buf, tree.files[i]->name.c_str(), 50);
1887 if (tree.files[i]->is_directory) {
1888 strcpy(dir_len, "\\t@b@.< DIR >\\t");
1891 sprintf(dir_len, "\\t%llu\\t", tree.files[i]->fsize);
1894 strcat(buf, dir_len);
1895 int cyear, cmonth, cday, chour, cmin, csec;
1896 tree.files[i]->ctime.GetDate(cyear, cmonth, cday);
1897 tree.files[i]->ctime.GetTime(chour, cmin, csec);
1898 sprintf(dir_len, "%02d/%02d/%04d %02d:%02d:%02d\\t", cday, cmonth, cyear, chour, cmin, csec);
1899 strcat(buf, dir_len);
1900 strcat(buf, tree.files[i]->mimetype.c_str());
1901 files_module_tree_br->add(buf);
1903 files_module_tree_br->redraw();
1905 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, root);
1906 sprintf(buf, "Path: %s | Total %d file%s and %d director%s", (root + current_file.name.c_str()).c_str(), files, (files == 1) ? "" : "s", dirs,
1907 (dirs == 1) ? "y" : "ies");
1908 files_module_status_to->value(buf);
1909 files_module_status_to->redraw();
1910 // this is unsorted tree
1911 select_files_tree_b->user_data(0);
1912 select_files_tree_b->label("Show Sorted");
1913 select_files_tree_b->redraw();
1914 files_tree_scroll->hide();
1915 files_module_w->resizable(files_module_tree_br);
1916 files_module_tree_br->show();
1917 files_module_w->redraw();
1921 Function {x11_ui::fill_preferences()} {return_type void
1925 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, t);
1926 config_files_module_unsorted_path_i->value(t.c_str());
1927 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, t);
1928 config_files_module_sorted_path_i->value(t.c_str());
1929 app->files_module_conf.get(FILES_MODULE_DESC_FILE_NAME, t);
1930 config_files_module_desc_file_name_i->value(t.c_str());
1931 u32_t gen_desc_files;
1932 app->files_module_conf.get(FILES_MODULE_DESC_FILE_ENABLE, &gen_desc_files);
1933 gen_desc_files_b->value(gen_desc_files);
1937 Function {x11_ui::log(int level, const char *fmt, ...)} {return_type void
1939 code {char buf[10240];
1940 const char *level_str;
1945 ::va_start(args, fmt);
1948 case SFINX_LOG_NOTICE:
1949 level_str = "NOTICE";
1951 case SFINX_LOG_WARN:
1954 case SFINX_LOG_ERROR:
1955 level_str = "ERROR";
1957 case SFINX_LOG_FATAL:
1958 level_str = "FATAL";
1961 level_str = "UNKN_LEVEL";
1964 strcpy(buf, level_str);
1966 ::vsnprintf(buf + strlen(level_str) + 2, sizeof(buf) - (strlen(level_str) + 2), fmt, args);
1969 log_m.leaveMutex();} {}
1972 Function {x11_ui::progress(sfinx_progress_t *p)} {return_type void
1975 static char buf[128];
1976 switch (p->status()) {
1977 case SFINX_PROGRESS_START:
1978 progress_l->label(p->label());
1979 strcpy(buf, p->strvalue());
1980 progress_bar->label(buf);
1981 progress_bar->minimum(0);
1982 progress_bar->maximum(p->max());
1983 progress_bar->value(p->value());
1985 progress_w->redraw();
1987 case SFINX_PROGRESS_END:
1990 case SFINX_PROGRESS_NONE:
1997 Function {x11_ui::alert(sfinx_string_t *alert)} {return_type void
2000 if (alert->size() != 1)
2001 fl_alert(alert->c_str());