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 {sfinx_slice_t *fill_tree_except;} {global
55 decl {u32_t fill_tree_mask;} {global
58 decl {sfinx_file_t current_file(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);} {}
60 Function {fill_objects_tree(Fl_Toggle_Tree *ft, u32_t m, sfinx_slice_t *except, bool force)} {private return_type void
64 fill_tree_except = except;
65 app->refresh_slices(force);} {}
68 Function {relink_slice_action()} {private return_type void
70 code {sfinx_slice_t slice(SFINX_SLICE_RELINK);
71 // slice to be relinked
72 Fl_Toggle_Node *node = slices_tree->selected();
75 Fl_Toggle_Node *snode = select_slice_tree->selected();
78 sfinx_slice_t *selected = (sfinx_slice_t *)snode->user_data();
79 sfinx_slice_t *rslice = (sfinx_slice_t *)node->user_data();
80 slice.id = rslice->id;
82 slice.parent_id = selected->id;
83 debug("moving from %lld to %lld", rslice->parent_id, selected->id);
84 app->sfinx.send(slice);
85 fill_objects_tree(slices_tree, SFINX_SLICE_OBJECT, 0, 1); // force refresh} {}
88 Function {select_note_atag_action()} {private return_type void
90 code {sfinx_object_t *obj;
91 Fl_Toggle_Node *node = select_slice_tree->selected();
94 if (node->can_open()) // slice
95 obj = ((sfinx_slice_t *)node->user_data())->object();
97 obj = (sfinx_object_t *)node->user_data();
98 Fl_Toggle_Node *snode = notes_tree->selected();
99 sfinx_object_t *sobj = (sfinx_object_t *)snode->user_data();
100 if (sobj == obj) // try to self tag
102 if (note_mtag_b->user_data() && !obj->cmp((sfinx_object_t *)note_mtag_b->user_data())) // already set as main tag
104 for (int i = 1; i <= note_tags_br->size(); i++) {
105 if (!obj->cmp((sfinx_object_t *)note_tags_br->data(i))) // already set as additional tag
108 string s = obj->name + " [ " + obj->description + " ]";
109 note_tags_br->add(s.c_str(), obj);
110 note_tags_br->redraw();} {}
113 Function {select_note_mtag_action()} {private return_type void
115 code {sfinx_object_t *obj;
116 Fl_Toggle_Node *node = select_slice_tree->selected();
119 if (node->can_open()) // slice
120 obj = ((sfinx_slice_t *)node->user_data())->object();
122 obj = (sfinx_object_t *)node->user_data();
123 Fl_Toggle_Node *snode = notes_tree->selected();
124 sfinx_object_t *sobj = (sfinx_object_t *)snode->user_data();
125 if (sobj == obj) // try to self tag
127 note_mtag_b->user_data(obj);
128 note_mtag_b->copy_label((obj->name + " [ " + obj->description + " ]").c_str());
129 note_mtag_b->redraw();
130 // check for additional slices if it is here - remove it
131 for (int i = 1; i <= note_tags_br->size(); i++) {
132 if (!obj->cmp((sfinx_object_t *)note_tags_br->data(i))) {
133 note_tags_br->remove(i);
139 Function {select_file_mtag_action()} {private return_type void
141 code {sfinx_object_t *obj;
142 Fl_Toggle_Node *node = select_slice_tree->selected();
145 if (node->can_open()) // slice
146 obj = ((sfinx_slice_t *)node->user_data())->object();
148 obj = (sfinx_object_t *)node->user_data();
149 file_mtag_b->user_data(obj);
150 file_mtag_b->copy_label((obj->name + " [ " + obj->description + " ]").c_str());
151 file_mtag_b->redraw();
152 // check for additional tags if it is here - remove it
153 for (int i = 1; i <= file_tags_br->size(); i++) {
154 if (!obj->cmp((sfinx_object_t *)file_tags_br->data(i))) {
155 file_tags_br->remove(i);
161 Function {select_file_atag_action()} {private return_type void
163 code {sfinx_object_t *obj;
164 Fl_Toggle_Node *node = select_slice_tree->selected();
168 if (node->can_open()) { // slice
169 obj = ((sfinx_slice_t *)node->user_data())->object();
170 s = obj->name + " [ " + obj->description + " ]";
172 obj = (sfinx_object_t *)node->user_data();
173 s = obj->name + obj->description;
175 if (file_mtag_b->user_data() && !obj->cmp((sfinx_object_t *)file_mtag_b->user_data())) // already set as main tag
177 for (int i = 1; i <= file_tags_br->size(); i++) {
178 if (!obj->cmp((sfinx_object_t *)file_tags_br->data(i))) // already set as additional tag
181 file_tags_br->add(s.c_str(), obj);
182 file_tags_br->redraw();} {}
185 Function {search_add_slice_action()} {private return_type void
187 code {for (int i = 1; i <= search_slices_br->size(); i++) {
188 // if (search_slices_br->data(i) == to_voidp(current_slice_id))
191 //sfinx_slice_t *slice = (sfinx_slice_t *)slices_tree->selected()->user_data();
192 //search_slices_br->add(slice->name(), to_voidp(current_slice_id));
193 search_slices_br->redraw();} {}
196 Function {slices_tree_cb(Fl_Widget *, void *)} {private return_type void
198 code {Fl_Toggle_Node *node = slices_tree->selected();
201 if (!Fl::event_clicks())
203 void (*select_slice_action)(void) = (void (*)())(slices_w->user_data());
204 if (select_slice_action) {
206 slices_w->user_data(0);
207 select_slice_action();
211 Function {notes_tree_cb(Fl_Widget *, void *)} {private return_type void
213 code {Fl_Toggle_Node *node = notes_tree->selected();
216 //current_note_id = from_voidp(node->user_data());
217 //current_slice_name = node->label();
218 if (!Fl::event_clicks())
220 void (*select_note_action)(void) = (void (*)())(notes_w->user_data());
221 if (select_note_action) {
222 notes_w->user_data(0);
223 select_note_action();
227 Function {files_tree_cb(Fl_Widget *, void *)} {private return_type void
229 code {Fl_Toggle_Node *node = files_tree->selected();
234 if (node->can_open()) { // slice
235 obj = ((sfinx_slice_t *)node->user_data())->object();
238 obj = (sfinx_object_t *)node->user_data();
243 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
244 obj->etime.GetDate(eyear, emonth, eday);
245 obj->etime.GetTime(ehour, emin, esec);
246 obj->ctime.GetDate(cyear, cmonth, cday);
247 obj->ctime.GetTime(chour, cmin, csec);
248 sprintf(buf, "Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", cday, cmonth,
249 cyear, chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
250 files_module_status_to->value((type + ": " + obj->name + " | " + buf).c_str());
251 if (!Fl::event_clicks())
253 void (*select_file_action)(void) = (void (*)())(files_module_w->user_data());
254 if (select_file_action) {
255 files_module_w->user_data(0);
256 select_file_action();
260 Function {select_slice_tree_cb(Fl_Widget *, void *)} {private return_type void
262 code {if (!Fl::event_clicks())
264 select_slice_b->do_callback();} {}
267 Function {write_preferences()} {private return_type void
269 code {app->server_name = config_sfinx_server_name_i->value();
270 app->files_module_conf.clear();
271 app->files_module_conf.add(FILES_MODULE_UNSORTED_PATH,
272 config_files_module_unsorted_path_i->value());
273 app->files_module_conf.add(FILES_MODULE_SORTED_TREE_PATH,
274 config_files_module_sorted_path_i->value());
275 app->files_module_conf.add(FILES_MODULE_DESC_FILE_NAME,
276 config_files_module_desc_file_name_i->value());
277 app->files_module_conf.add(FILES_MODULE_DESC_FILE_ENABLE,
278 gen_desc_files_b->value());
279 app->write_preferences();} {}
282 Function {config_tree_cb(Fl_Widget *, void *)} {private return_type void
284 code {static Fl_Group *prev_group;
285 Fl_Toggle_Node *node = config_tree->selected();
287 Fl_Group *gr = *((Fl_Group **)(node->user_data()));
292 //config_tree->unselect();
296 Function {fill_config_tree()} {private return_type void
298 code {config_tree->add_next("Connection", 0, 0, (void *)&config_connection_gr);
299 config_tree->add_next("Files Module", 0, 0, (void *)&config_files_module_gr);
300 config_tree->add_next("Confirmation", 0, 0, (void *)&config_confirmation_gr);
301 config_tree->callback(config_tree_cb);
302 config_tree->edit_on_reselect(0);} {}
305 Function {x11_ui::init()} {open return_type void
309 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
310 F::shutdown(0);} open
311 xywh {171 126 945 365} type Double hide
318 xywh {0 0 67 22} labeltype ENGRAVED_LABEL
321 label {Connect to ...}
322 xywh {0 0 34 22} shortcut 0x80063 labeltype ENGRAVED_LABEL deactivate
325 label {Connect to default server}
326 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
329 label {Disconnect from Sfinx}
330 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
333 label {Connection Info}
334 xywh {20 20 34 22} shortcut 0x80069 labeltype ENGRAVED_LABEL deactivate
338 xywh {30 30 34 22} labeltype ENGRAVED_LABEL deactivate divider
342 callback {app->read_preferences();
343 config_sfinx_server_name_i->value(app->server_name.c_str());
344 preferences_w->show();}
345 xywh {30 30 34 22} shortcut 0x80070 labeltype ENGRAVED_LABEL divider
349 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
351 xywh {20 20 34 22} shortcut 0x80078 labeltype ENGRAVED_LABEL
356 xywh {10 10 67 22} labeltype ENGRAVED_LABEL
360 callback {if (!app->connected()) {
361 fl_message("Not connected to Sfinx Server !");
364 xywh {10 10 34 22} shortcut 0x61 labeltype ENGRAVED_LABEL deactivate
368 callback {if (!app->connected()) {
369 fl_message("Not connected to Sfinx Server !");
372 fill_objects_tree(slices_tree, 1 << SFINX_SLICE_OBJECT, 0, 0); // fluid bugs if any default params exists !
374 xywh {10 10 34 22} shortcut 0x73 labeltype ENGRAVED_LABEL
377 label {Knowledge Module}
378 callback {if (!app->connected()) {
379 fl_message("Not connected to Sfinx Server !");
382 xywh {40 40 34 22} shortcut 0x6b labeltype ENGRAVED_LABEL deactivate
386 callback {if (!app->connected()) {
387 fl_message("Not connected to Sfinx Server !");
390 xywh {40 40 34 22} shortcut 0x74 labeltype ENGRAVED_LABEL deactivate
394 callback {if (!app->connected()) {
395 fl_message("Not connected to Sfinx Server !");
398 xywh {40 40 34 22} shortcut 0x6d labeltype ENGRAVED_LABEL deactivate
402 callback {if (!app->connected()) {
403 fl_message("Not connected to Sfinx Server !");
406 xywh {50 50 34 22} shortcut 0x63 labeltype ENGRAVED_LABEL deactivate
410 callback {if (!app->connected()) {
411 fl_message("Not connected to Sfinx Server !");
414 xywh {40 40 34 22} shortcut 0x65 labeltype ENGRAVED_LABEL deactivate
418 callback {if (!app->connected()) {
419 fl_message("Not connected to Sfinx Server !");
422 if (current_file.tid() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) {
423 if (app->sfinx.send(current_file))
426 fill_objects_tree(files_tree, (1 << SFINX_FILE_OBJECT), 0, 0);
427 files_module_w->show();}
428 xywh {20 20 34 22} shortcut 0x66 labeltype ENGRAVED_LABEL
432 callback {if (!app->connected()) {
433 fl_message("Not connected to Sfinx Server !");
436 // ÒÉÓÕÅÍ ÄÅÒÅ×Ï ÚÁÍÅÔÏË
437 fill_objects_tree(notes_tree, 1 << SFINX_NOTE_OBJECT, 0, 0); // fluid bugs if any default params exists !
439 xywh {30 30 34 22} shortcut 0x6e labeltype ENGRAVED_LABEL
444 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
447 label {Browser && Searcher}
448 callback {if (!app->connected()) {
449 fl_message("Not connected to Sfinx Server !");
452 search_i->take_focus();
454 xywh {30 30 34 22} shortcut 0x62 labeltype ENGRAVED_LABEL
458 callback {if (!app->connected()) {
459 fl_message("Not connected to Sfinx Server !");
462 xywh {30 30 34 22} shortcut 0x72 labeltype ENGRAVED_LABEL deactivate divider
466 callback {if (!app->connected()) {
467 fl_message("Not connected to Sfinx Server !");
470 xywh {40 40 34 22} shortcut 0x40061 labeltype ENGRAVED_LABEL deactivate
473 label {Knowledge Tracer}
474 callback {if (!app->connected()) {
475 fl_message("Not connected to Sfinx Server !");
478 xywh {40 40 34 22} shortcut 0x4006b labeltype ENGRAVED_LABEL deactivate
481 label {Indexing machine}
482 callback {if (!app->connected()) {
483 fl_message("Not connected to Sfinx Server !");
486 xywh {30 30 34 22} shortcut 0x40069 labeltype ENGRAVED_LABEL deactivate
489 label {Check Sfinx DB}
490 callback {if (!app->connected()) {
491 fl_message("Not connected to Sfinx Server !");
494 xywh {40 40 34 22} shortcut 0x40064 labeltype ENGRAVED_LABEL deactivate
498 callback {if (!app->connected()) {
499 fl_message("Not connected to Sfinx Server !");
502 xywh {30 30 34 22} shortcut 0x40062 labeltype ENGRAVED_LABEL deactivate divider
505 label {Clear log window}
506 callback {log_br->clear();}
507 xywh {30 30 34 22} shortcut 0x10063 labeltype ENGRAVED_LABEL
512 xywh {20 20 67 22} labeltype ENGRAVED_LABEL deactivate
516 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
520 xywh {30 30 34 22} shortcut 0xffbe labeltype ENGRAVED_LABEL deactivate divider
524 callback {about_w->show();}
525 xywh {30 30 34 22} shortcut 0x80061 labeltype ENGRAVED_LABEL
529 Fl_Output status_bar_o {
530 tooltip Status xywh {0 347 945 20} box PLASTIC_UP_BOX color 31 deactivate
533 xywh {-1 21 948 326} type Select color 31 labelfont 4 textfont 4
536 Fl_Window preferences_w {
538 xywh {215 308 742 373} type Double color 31 hide
542 callback {preferences_w->hide();}
543 xywh {390 330 112 25} labeltype ENGRAVED_LABEL
547 callback {write_preferences();
548 preferences_w->hide();}
549 xywh {572 330 112 25} labeltype ENGRAVED_LABEL
551 Fl_Scroll prefs_tree_scroll {
552 xywh {10 29 173 283} type VERTICAL_ALWAYS box ENGRAVED_FRAME color 28
553 code0 {config_tree = new Fl_Toggle_Tree(12, 12, prefs_tree_scroll->w() - prefs_tree_scroll->scrollbar.w(), 10);}
554 code1 {fill_config_tree();}
556 Fl_Group config_connection_gr {open
557 xywh {183 19 535 283} box ENGRAVED_FRAME hide
559 Fl_Input config_sfinx_server_name_i {
560 label {Sfinx Server Name}
561 xywh {273 89 375 26} color 29 labeltype ENGRAVED_LABEL align 1
564 label {Minimum Auth Level}
565 xywh {227 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
568 label {User Name && Passsword}
577 label {Minimum Debug Level}
578 xywh {227 230 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
597 label {Warning Level}
609 label {Critical Level}
618 label {Minimum Crypt Level}
619 xywh {476 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
631 Fl_Group config_files_module_gr {
632 xywh {193 29 535 283} box ENGRAVED_FRAME hide
634 Fl_Input config_files_module_unsorted_path_i {
635 label {Unsorted files path on Sfinx server}
636 xywh {283 68 375 26} color 29 labeltype ENGRAVED_LABEL align 1
638 Fl_Input config_files_module_sorted_path_i {
639 label {Sorted file tree path on Sfinx server}
640 xywh {283 128 375 26} color 29 labeltype ENGRAVED_LABEL align 1
642 Fl_Check_Button gen_desc_files_b {
643 label {Generate description files}
644 xywh {209 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
646 Fl_Input config_files_module_desc_file_name_i {
647 label {Description file name}
648 xywh {283 189 375 26} color 29 labeltype ENGRAVED_LABEL align 1
650 Fl_Check_Button process_files_mime_type_b {
651 label {Detect files MIME type}
652 xywh {472 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
655 Fl_Group config_confirmation_gr {
656 xywh {183 19 535 283} box ENGRAVED_FRAME hide
658 Fl_Check_Button exit_confirm_b {
660 xywh {216 45 204 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL deactivate
664 Fl_Window select_slice_w {
665 label {Select Sfinx Slice}
666 xywh {67 62 730 352} type Double color 31 hide modal
670 callback {select_slice_w->hide();}
671 xywh {594 312 112 25} box PLASTIC_UP_BOX labeltype ENGRAVED_LABEL
673 Fl_Button select_slice_b {
675 callback {Fl_Toggle_Node *node = select_slice_tree->selected();
678 void (*select_slice_action)() = (void (*)())(select_slice_w->user_data());
679 if (select_slice_action) {
680 select_slice_w->user_data(0);
681 select_slice_action();
683 select_slice_w->hide();}
684 xywh {16 312 548 25} box PLASTIC_UP_BOX labeltype ENGRAVED_LABEL
686 Fl_Scroll select_slice_tree_scroll {open
687 xywh {15 15 702 280} box ENGRAVED_FRAME color 28
688 code0 {select_slice_tree = new Fl_Toggle_Tree(12, 12, select_slice_tree_scroll->w(), 10);}
689 code1 {select_slice_tree->callback(select_slice_tree_cb);select_slice_tree->user_data((void *)select_slice_tree_scroll);}
690 code2 {select_slice_w->resizable(select_slice_tree_scroll);}
691 code3 {select_slice_tree_scroll->resizable(select_slice_tree);}
692 class Fl_Scroll_Resize
696 label {Sfinx Data} open
697 xywh {200 315 866 370} type Double color 31 hide modal
701 callback {slices_w->hide();}
702 xywh {734 312 112 25} labeltype ENGRAVED_LABEL
706 callback {Fl_Toggle_Node *node = slices_tree->selected();
709 sfinx_slice_t *slice = (sfinx_slice_t *)node->user_data();
710 if (slice->id == 1) // Root Slice can't be deleted
712 // set safe deletion mode
713 slice_deletion_type_ch->value(0);
714 data_deletion_type_ch->value(0);
715 delete_sfinx_slice_to->value(slice->name());
716 delete_slice_w->show();}
717 xywh {454 312 128 25} labeltype ENGRAVED_LABEL
719 Fl_Scroll slices_tree_scroll {
720 xywh {15 13 837 280} box ENGRAVED_FRAME color 28
721 code0 {slices_tree = new Fl_Toggle_Tree(12, 12, slices_tree_scroll->w(), 10);}
722 code1 {slices_tree->callback(slices_tree_cb); slices_tree->user_data((void *)slices_tree_scroll);}
723 code2 {slices_w->resizable(slices_tree_scroll);}
724 code3 {slices_tree_scroll->resizable(slices_tree);}
725 class Fl_Scroll_Resize
729 callback {Fl_Toggle_Node *node = slices_tree->selected();
732 sfinx_slice_t *slice = (sfinx_slice_t *)node->user_data();
733 edit_slice_w->user_data((void *)slice);
734 app->sfinx.send(SFINX_EDIT_SLICE_REQUEST, (u32_t)slice->id);
735 edit_slice_w->label("Edit Sfinx Slice");}
736 xywh {305 312 128 25} labeltype ENGRAVED_LABEL
738 Fl_Output slices_status_to {
739 xywh {0 349 866 21} box PLASTIC_UP_BOX color 31 deactivate
743 callback {Fl_Toggle_Node *node = slices_tree->selected();
745 fl_alert("Please select slice connection point !");
748 edit_slice_w->user_data(0); // new slice
749 slice_name_i->value(0);
750 slice_directory_i->value(0);
751 slice_name_i->take_focus();
752 slice_description_i->value(0);
753 sfinx_slice_t *slice = (sfinx_slice_t *)slices_tree->selected()->user_data();
754 edit_slice_to->value(string(string("Parent slice: ") + slice->name()).c_str());
755 edit_slice_w->label("New Sfinx Slice");
756 edit_slice_w->show();}
757 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
761 callback {Fl_Toggle_Node *node = slices_tree->selected();
764 sfinx_slice_t *slice = (sfinx_slice_t *)node->user_data();
765 if (slice->id == 1) // root slice can't be relinked
767 fill_objects_tree(select_slice_tree, SFINX_SLICE_OBJECT, slice, 0);
768 select_slice_w->user_data((void *)relink_slice_action);
769 select_slice_w->show();}
770 xywh {155 312 128 25} labeltype ENGRAVED_LABEL
774 callback {search_mi->do_callback(0, (void *)0);}
775 xywh {600 312 119 25} labeltype ENGRAVED_LABEL
778 Fl_Window edit_slice_w {
779 label {Edit Sfinx Slice}
780 xywh {276 319 595 330} type Double color 31 hide modal
782 Fl_Input slice_name_i {
784 xywh {47 35 496 26} color 29 labeltype ENGRAVED_LABEL align 1
786 Fl_Input slice_directory_i {
787 label {Slice Directory}
788 xywh {47 93 496 26} color 29 labeltype ENGRAVED_LABEL align 1
790 Fl_Input slice_description_i {
791 label {Slice Description}
792 xywh {34 158 523 89} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
794 Fl_Return_Button {} {
796 callback {if (!slice_name_i->size()) {
797 fl_message("Missing slice name !");
800 sfinx_slice_t *eslice = (sfinx_slice_t *)edit_slice_w->user_data();
803 slice.tid(SFINX_EDIT_SLICE);
804 slice.id = eslice->id; // edited slice id
805 slice.parent_id = eslice->parent_id;
807 slice.tid(SFINX_NEW_SLICE);
808 sfinx_slice_t *s = (sfinx_slice_t *)(slices_tree->selected()->user_data());
809 slice.parent_id = s->id; // parent id for new slice
811 slice.name(slice_name_i->value());
812 slice.directory(slice_directory_i->value());
813 slice.description(slice_description_i->value());
814 app->sfinx.send(slice);
815 edit_slice_w->hide();
816 fill_objects_tree(slices_tree, 1 << SFINX_SLICE_OBJECT, 0, 1); // force refresh}
817 xywh {111 270 112 25} labeltype ENGRAVED_LABEL
821 callback {edit_slice_w->hide();}
822 xywh {359 270 112 25} labeltype ENGRAVED_LABEL
824 Fl_Output edit_slice_to {
825 xywh {0 312 598 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
828 Fl_Window delete_slice_w {
829 label {Delete Sfinx Slice}
830 xywh {350 43 388 223} type Double color 31 hide modal
834 callback {delete_slice_w->hide();}
835 xywh {238 175 112 25} labeltype ENGRAVED_LABEL
839 callback {// need to confirm deletion ?!
840 bool recursivly = slice_deletion_type_ch->value();
841 sfinx_slice_t *slice = (sfinx_slice_t *)slices_tree->selected()->user_data();
842 app->sfinx.send(data_deletion_type_ch->value() ?
843 (recursivly ? SFINX_DELETE_SLICE_ASSOC_DATA_RECURSIVLY : SFINX_DELETE_SLICE_ASSOC_DATA) :
844 (recursivly ? SFINX_DELETE_SLICE_MARK_DATA_UNSORTED_RECURSIVLY : SFINX_DELETE_SLICE_MARK_DATA_UNSORTED),
846 app->sfinx.send(recursivly ? SFINX_DELETE_SLICE_RECURSIVLY : SFINX_DELETE_SLICE_WITH_REATTACH,
848 delete_slice_w->hide();
849 fill_objects_tree(slices_tree, 1 << SFINX_SLICE_OBJECT, 0, 1); // force refresh}
850 xywh {39 175 112 25} labeltype ENGRAVED_LABEL
852 Fl_Output delete_sfinx_slice_to {
853 label {Please confirm deletion of the slice}
854 xywh {35 31 330 26} box ENGRAVED_FRAME color 29 labeltype ENGRAVED_LABEL align 1
856 Fl_Choice slice_deletion_type_ch {
857 label {Slice && Data Deletion Action}
858 xywh {73 82 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 1
861 label {Attach subslices to parent}
865 label {Delete all subslices recursivly}
869 Fl_Choice data_deletion_type_ch {
870 label {Associated Data Deletion Action}
871 xywh {73 132 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 1
874 label {Mark all data 'Unsorted'}
878 label {Delete all data}
883 Fl_Window progress_w {
885 xywh {286 302 464 98} type Double hide
887 Fl_Progress progress_bar {
889 xywh {22 46 422 27} box PLASTIC_DOWN_BOX selection_color 2
892 label {Doing some work ...}
893 xywh {66 10 330 25} box FLAT_BOX labeltype ENGRAVED_LABEL
896 Fl_Window files_module_w {
897 label {Files Module} open
898 xywh {87 152 730 370} type Double color 31 hide
902 callback {files_module_w->hide();}
903 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
905 Fl_Output files_module_status_to {
906 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
908 Fl_Button classify_file_b {
910 callback {int n = files_module_tree_br->value();
913 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
915 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
917 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
918 file->etime.GetDate(eyear, emonth, eday);
919 file->etime.GetTime(ehour, emin, esec);
920 file->ctime.GetDate(cyear, cmonth, cday);
921 file->ctime.GetTime(chour, cmin, csec);
922 sprintf(buf, "%llu bytes | Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", file->fsize, cday, cmonth,
923 cyear, chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
924 string t = "URL: " + path + current_file.name + "/" + file->name + " | " + file->mimetype + " | Size: " + buf;
925 classify_file_to->value(t.c_str());
926 file_title_i->value(0);
927 file_name_i->value(file->name.c_str());
928 // save orig file name
929 file->orig_name = file->name;
930 file->tid(SFINX_FILES_MODULE_CLASSIFY_REQUEST); // new file
931 file_title_i->take_focus();
932 file_authority_i->value(0);
933 file_description_i->value(0);
934 file_comments_i->value(0);
935 sorted_location_b->value(1);
936 file_compress_b->value(1);
937 file_gen_csum_b->value(1);
938 file_mtag_b->label("Main Slice (Not Set)");
939 file_mtag_b->user_data(0); // ÔÕÔÁ ÈÒÁÎÉÔÓÑ mtag
940 file_tags_br->clear();
941 classify_file_w->user_data((void *)file);
942 classify_file_w->label("Classify File");
943 classify_file_w->show();}
944 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
948 callback {Fl_Toggle_Node *node = files_tree->selected();
949 if (!node || node->can_open()) {
950 fl_alert("Please select file to edit !");
953 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
954 if (obj->type != SFINX_FILE_OBJECT)
956 sfinx_file_t file(SFINX_FILES_MODULE_EDIT_REQUEST);
958 app->sfinx.send(file);}
959 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
961 Fl_Browser files_module_tree_br {
962 callback {if (!Fl::event_clicks())
964 sfinx_files_vector_t *tree = (sfinx_files_vector_t *) files_module_tree_br->user_data();
965 int n = files_module_tree_br->value();
966 if (tree->files[n - 1]->is_directory) { // ÀÚÅÒ ÓÍÅÎÉÌ ÄÉÒÅËÔÏÒÉÀ
967 current_file.id = tree->files[n - 1]->id;
968 current_file.mtag.id = tree->files[n - 1]->mtag.id;
969 current_file.name += ('/' + tree->files[n - 1]->name);
970 app->sfinx.send(current_file);
972 if (!(tree->files[n - 1]->id)) // classify file
973 classify_file_b->do_callback();
975 xywh {7 45 716 255} type Multi color 31
976 code0 {static int widths[] = { 10, 450, 200, 200, 0};}
977 code1 {files_module_tree_br->column_widths(widths);}
981 callback {if (current_file.tid() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) { // unsorted tree
982 int n = files_module_tree_br->value();
985 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
986 string path; // sure ?
987 string message = "Deleting ";
988 if (file->is_directory)
989 message += "directory";
992 message += (" \\'" + file->name + "\\'. Are you sure ?");
993 if (fl_choice(message.c_str(), "Yes", "No", 0L))
995 file->tid(SFINX_FILES_MODULE_UNSORTED_DELETE);
996 app->sfinx.send(file); // check for errors ?
997 app->sfinx.send(current_file);
998 } else { // sorted tree
999 Fl_Toggle_Node *node = files_tree->selected();
1000 if (!node || node->can_open())
1002 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1003 string message = "Delete or Unsort \\'" + obj->name + "\\' ?";
1004 int res = fl_choice(message.c_str(), "Cancel", "Unsort", "Delete");
1007 file.mtag.slice_id = obj->slice_id;
1010 if (res == 2) // delete
1011 file.tid(SFINX_FILES_MODULE_SORTED_UNLINK);
1013 file.tid(SFINX_FILES_MODULE_UNSORT);
1014 app->sfinx.send(file);
1015 fill_objects_tree(files_tree, (1 << SFINX_FILE_OBJECT), 0, 1); // fluid bugs if any default params exists !
1018 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
1020 Fl_Button select_files_tree_b {
1022 callback {current_file.name.clear();
1023 current_file.orig_name.clear();
1024 if (select_files_tree_b->user_data()) {
1025 current_file.tid(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);
1026 current_file.id = 0;
1027 select_files_tree_b->user_data(0);
1028 app->sfinx.send(current_file);
1030 select_files_tree_b->user_data((void *)1);
1031 select_files_tree_b->label("Show Unsorted");
1032 select_files_tree_b->redraw();
1033 current_file.tid(0);
1034 files_module_status_to->value("Sorted Files Tree");
1035 current_file.id = 1; // root id
1036 files_module_tree_br->hide();
1037 files_tree_scroll->resize(files_tree_scroll->x(), files_tree_scroll->y(), files_module_tree_br->w(), files_module_tree_br->h());
1038 files_module_w->resizable(files_tree_scroll);
1039 fill_objects_tree(files_tree, 1 << SFINX_FILE_OBJECT, 0, 0); // fluid bugs if any default params exists !
1040 files_tree_scroll->show();
1042 xywh {562 10 128 25} labeltype ENGRAVED_LABEL
1046 callback {const char *p = strrchr(current_file.name.c_str(), '/');
1048 if (!current_file.name.size())
1050 current_file.name.clear();
1054 strncat(path, current_file.name.c_str(), p - current_file.name.c_str());
1055 current_file.name = path;
1056 current_file.id = current_file.mtag.id;
1058 app->sfinx.send(current_file);}
1059 xywh {35 10 112 25} labeltype ENGRAVED_LABEL
1063 callback {app->sfinx.send(current_file);}
1064 xywh {166 10 112 25} labeltype ENGRAVED_LABEL
1068 callback {//for (int i = 1; i <= files_module_tree_br->size(); i++)
1069 // files_module_tree_br->select(i);}
1070 xywh {295 10 112 25} labeltype ENGRAVED_LABEL
1073 label {Unselect All}
1074 callback {files_module_tree_br->deselect();}
1075 xywh {428 10 112 25} labeltype ENGRAVED_LABEL
1077 Fl_Scroll files_tree_scroll {selected
1078 xywh {7 45 716 255} type BOTH_ALWAYS box ENGRAVED_FRAME color 28 hide
1079 code0 {files_tree = new Fl_Toggle_Tree(12, 12, files_tree_scroll->w(), 10);}
1080 code1 {files_tree->callback(files_tree_cb); files_tree->user_data((void *)files_tree_scroll);}
1081 code2 {files_module_w->resizable(files_tree_scroll);}
1082 code3 {files_tree_scroll->resizable(files_tree);}
1086 Fl_Window classify_file_w {
1087 label {Classify File}
1088 xywh {84 298 1020 515} type Double color 31 hide modal
1092 callback {classify_file_w->hide();}
1093 xywh {612 454 112 25} labeltype ENGRAVED_LABEL
1095 Fl_Input file_title_i {
1097 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1099 Fl_Input file_authority_i {
1101 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1103 Fl_Input file_description_i {
1105 xywh {549 78 447 101} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1107 Fl_Input file_comments_i {
1109 xywh {582 220 416 212} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1111 Fl_Output classify_file_to {
1112 xywh {0 497 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
1114 Fl_Return_Button {} {
1116 callback {if (!file_mtag_b->user_data()) {
1117 fl_alert("You have to select Main Slice for file !");
1120 if (!file_name_i->size()) {
1121 fl_alert("File must have some name !");
1124 sfinx_file_t *file = (sfinx_file_t *)classify_file_w->user_data();
1125 file->name = file_name_i->value();
1126 file->title = file_title_i->value();
1127 file->authority = file_authority_i->value();
1128 file->description = file_description_i->value();
1129 file->comments = file_comments_i->value();
1130 file->sorted_location = sorted_location_b->value();
1131 file->store_compressed = file_compress_b->value();
1132 file->generate_csum = file_gen_csum_b->value();
1133 sfinx_object_t *obj = (sfinx_object_t *)file_mtag_b->user_data();
1134 file->mtag.id = obj->id;
1135 file->mtag.type = obj->type;
1136 file->mtag.slice_id = obj->slice_id;
1137 file_mtag_b->user_data(0);
1139 for (int i = 1; i <= file_tags_br->size(); i++) {
1140 obj = (sfinx_object_t *)file_tags_br->data(i);
1141 file->tags.push_back(*obj);
1142 file_tags_br->data(i, 0);
1144 app->sfinx.send(file);}
1145 xywh {243 454 112 25} labeltype ENGRAVED_LABEL
1147 Fl_Check_Button sorted_location_b {
1148 label {Sorted Location}
1149 xywh {15 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1151 Fl_Check_Button file_crypt_b {
1153 xywh {15 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
1155 Fl_Check_Button file_compress_b {
1156 label {Store compressed}
1157 xywh {274 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1160 xywh {13 205 552 227} box ENGRAVED_FRAME
1162 Fl_Button file_mtag_b {
1163 label {Main Slice (Not Set)}
1164 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 !
1165 select_slice_w->user_data((void *)select_file_mtag_action);
1166 select_slice_w->show();}
1167 tooltip {File Main Slice} xywh {45 226 489 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1169 Fl_Browser file_tags_br {
1170 label {Additional Slices}
1171 xywh {26 275 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1173 Fl_Button file_add_tag_b {
1175 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 !
1176 select_slice_w->user_data((void *)select_file_atag_action);
1177 select_slice_w->show();}
1178 xywh {82 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1180 Fl_Button file_remove_tag_b {
1181 label {Remove Slice}
1182 callback {for (int i = file_tags_br->size(); i >= 1; i--) {
1183 if (file_tags_br->selected(i))
1184 file_tags_br->remove(i);
1186 xywh {358 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1188 Fl_Input file_name_i {
1190 xywh {549 26 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1192 Fl_Check_Button file_gen_csum_b {
1193 label {Generate CSUM}
1194 xywh {274 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1198 label {Notes Module}
1199 xywh {272 69 730 370} type Double color 31 hide resizable
1203 callback {notes_w->hide();}
1204 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
1206 Fl_Output notes_module_status_to {
1207 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
1211 callback {Fl_Toggle_Node *node = notes_tree->selected();
1213 fl_alert("Please select slice connection point !");
1216 sfinx_note_t *note = new sfinx_note_t(SFINX_NOTES_MODULE_ADD);
1217 edit_note_w->user_data((void *)note);
1218 sfinx_object_t *obj;
1219 if (node->can_open()) // slice
1220 obj = ((sfinx_slice_t *)node->user_data())->object();
1222 obj = (sfinx_object_t *) node->user_data();
1223 note_mtag_b->user_data(obj);
1224 note_mtag_b->copy_label((obj->name + " [ " + obj->description + " ]").c_str());
1225 note_mtag_b->redraw();
1226 note_name_i->value(0);
1227 note_url_i->value(0);
1228 note_text_i->value(0);
1229 note_name_i->take_focus();
1230 edit_note_w->label("New Note");
1231 edit_note_w->show();}
1232 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
1236 callback {Fl_Toggle_Node *node = notes_tree->selected();
1237 if (!node || node->can_open()) {
1238 fl_alert("Please select note to edit !");
1241 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1242 if (obj->type != SFINX_NOTE_OBJECT)
1244 sfinx_note_t note(SFINX_NOTES_MODULE_EDIT_REQUEST);
1246 app->sfinx.send(note);}
1247 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
1249 Fl_Scroll notes_tree_scroll {
1250 xywh {13 10 705 289} box ENGRAVED_FRAME color 28
1251 code0 {notes_tree = new Fl_Toggle_Tree(12, 12, notes_tree_scroll->w(), 10);}
1252 code1 {notes_tree->callback(notes_tree_cb); notes_tree->user_data((void *)notes_tree_scroll);}
1253 code2 {notes_w->resizable(notes_tree_scroll);}
1254 code3 {notes_tree_scroll->resizable(notes_tree);}
1255 class Fl_Scroll_Resize
1259 callback {Fl_Toggle_Node *node = notes_tree->selected();
1260 if (!node || node->can_open())
1262 sfinx_object_t *obj = (sfinx_object_t *) node->user_data();
1263 delete_sfinx_note_to->value(obj->name.c_str());
1264 delete_note_w->user_data(obj);
1265 delete_note_w->show();}
1266 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
1269 Fl_Window edit_note_w {
1271 xywh {212 174 1020 385} type Double color 31 hide modal
1275 callback {edit_note_w->hide();}
1276 xywh {648 321 112 25} labeltype ENGRAVED_LABEL
1278 Fl_Input note_name_i {
1280 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1282 Fl_Input note_url_i {
1284 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
1286 Fl_Input note_text_i {
1288 xywh {16 141 496 158} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
1290 Fl_Output edit_note_to {
1291 xywh {0 364 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
1293 Fl_Return_Button {} {
1295 callback {if (!note_mtag_b->user_data()) {
1296 fl_alert("You have to select Main Object for note !");
1299 if (!note_name_i->size()) {
1300 fl_alert("Note must have some name !");
1303 if (!note_text_i->size()) {
1304 fl_alert("Note must have some text !");
1307 sfinx_note_t *note = (sfinx_note_t *)edit_note_w->user_data();
1308 note->name = note_name_i->value();
1309 note->url = note_url_i->value();
1310 note->text = note_text_i->value();
1311 sfinx_object_t *obj = (sfinx_object_t *)note_mtag_b->user_data();
1312 note->mtag.id = obj->id;
1313 note->mtag.type = obj->type;
1314 note->mtag.slice_id = obj->slice_id;
1315 note_mtag_b->user_data(0);
1317 for (int i = 1; i <= note_tags_br->size(); i++) {
1318 obj = (sfinx_object_t *)note_tags_br->data(i);
1319 note->tags.push_back(*obj);
1320 note_tags_br->data(i, 0);
1322 app->sfinx.send(note);
1324 edit_note_w->user_data(0);}
1325 xywh {279 321 112 25} labeltype ENGRAVED_LABEL
1328 xywh {535 72 467 227} box ENGRAVED_FRAME
1330 Fl_Button note_mtag_b {
1331 label {Main Note Tag (Not Set)}
1332 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 !
1333 slices_w->user_data((void *)select_note_mtag_action);
1335 tooltip {Note Main Tag} xywh {594 93 348 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1337 Fl_Browser note_tags_br {
1338 label {Additional Note Tags}
1339 xywh {559 146 420 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1341 Fl_Button note_add_tag_b {
1343 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 !
1344 slices_w->user_data((void *)select_note_atag_action);
1346 xywh {584 258 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1348 Fl_Button note_remove_tag_b {
1350 callback {for (int i = note_tags_br->size(); i >= 1; i--) {
1351 if (note_tags_br->selected(i))
1352 note_tags_br->remove(i);
1354 xywh {811 258 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1356 Fl_Choice note_secured_ch {
1357 label {Secure Level}
1358 xywh {536 27 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
1365 label {Crypted Text}
1370 Fl_Window delete_note_w {
1372 xywh {44 182 388 168} type Double color 31 hide modal
1376 callback {delete_note_w->hide();}
1377 xywh {239 122 112 25} labeltype ENGRAVED_LABEL
1381 callback {sfinx_object_t *obj = (sfinx_object_t *) delete_note_w->user_data();
1382 sfinx_note_t note(note_deletion_type_ch->value() ? SFINX_NOTES_MODULE_UNLINK : SFINX_NOTES_MODULE_UNSORT);
1384 note.mtag.slice_id = obj->slice_id;
1385 app->sfinx.send(note);
1386 delete_note_w->user_data(0);
1387 delete_note_w->hide();
1388 fill_objects_tree(notes_tree, (1 << SFINX_SLICE_OBJECT) | (1 << SFINX_NOTE_OBJECT), 0, 1); // force refresh}
1389 xywh {40 122 112 25} labeltype ENGRAVED_LABEL
1391 Fl_Output delete_sfinx_note_to {
1392 label {Please confirm deletion of the note}
1393 xywh {31 26 330 26} box ENGRAVED_FRAME color 29 labeltype ENGRAVED_LABEL align 1
1395 Fl_Choice note_deletion_type_ch {
1396 label {Associated Data Deletion Action}
1397 xywh {74 80 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 1
1400 label {Mark all data 'Unsorted'}
1404 label {Delete all data}
1409 Fl_Window search_browser_w {
1410 label {Search Browser}
1411 xywh {217 305 854 476} type Double color 31 hide resizable modal
1415 callback {search_browser_w->hide();}
1416 xywh {638 449 187 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1418 Fl_Browser search_browser_br {
1419 xywh {4 4 846 439} type Hold box GTK_THIN_UP_BOX color 44 resizable
1422 label {Previous Page}
1423 xywh {25 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1427 xywh {231 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1429 Fl_Choice goto_page_ch {
1430 label {Current Page }
1431 xywh {531 450 72 20} box PLASTIC_THIN_UP_BOX down_box PLASTIC_THIN_UP_BOX color 44 labeltype ENGRAVED_LABEL
1434 Fl_Window search_w {
1436 xywh {169 380 749 389} type Double color 31 hide modal
1440 callback {search_w->hide();}
1441 xywh {182 347 363 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1443 Fl_Return_Button {} {
1445 callback {sfinx_search_query_t query;
1446 query.pattern = search_i->value();
1447 if (search_in_files_b->value())
1448 query.add_area(SFINX_SEARCH_IN_FILES);
1449 // add restrictions ...
1450 app->sfinx.send(query);}
1451 xywh {539 48 163 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1453 Fl_Check_Button search_in_files_b {
1454 label {Search in Files}
1455 xywh {48 96 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
1458 xywh {87 141 561 189} box ROUNDED_FRAME
1460 Fl_Browser search_slices_br {
1461 label {Restrict Search by Slices}
1462 xywh {105 173 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1464 Fl_Button search_add_slice_b {
1466 callback {app->refresh_slices();
1467 slices_w->user_data((void *)search_add_slice_action);
1469 xywh {161 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1472 label {Remove Slice}
1473 callback {for (int i = search_slices_br->size(); i >= 1; i--) {
1474 if (search_slices_br->selected(i))
1475 search_slices_br->remove(i);
1477 xywh {437 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1480 label {Search for ...}
1481 xywh {46 47 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1485 xywh {357 229 374 154} type Double hide
1489 callback {about_w->hide();}
1490 xywh {72 122 226 20} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1493 image {../docs/sfinx.jpg} xywh {10 9 130 101}
1497 xywh {203 6 99 33} labeltype EMBOSSED_LABEL labelfont 9 labelsize 32
1500 label {Personal knowledge manager}
1501 xywh {150 40 214 22} labeltype EMBOSSED_LABEL labelcolor 64
1504 label {Copyright (C) 2007 Rus V. Brushkoff}
1505 xywh {150 58 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1508 label {Email: Rus@@Sfinx.Od.UA}
1509 xywh {150 75 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1512 label {http://sfinx.od.ua/index.php?id=sfinx}
1513 xywh {150 93 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1516 code {main_w->show();} {}
1519 Function {x11_ui::edit_slice(sfinx_slice_t *slice)} {return_type void
1523 slice_name_i->value(slice->name());
1524 slice_directory_i->value(slice->directory());
1525 slice_name_i->take_focus();
1526 slice_description_i->value(slice->description());
1527 string status_line = "Parent slice: ";
1528 status_line += slice->parent_name();
1529 int cyear, cmonth, cday, eyear, emonth, eday, chour, cmin, csec, ehour, emin, esec;
1530 slice->ctime.GetDate(cyear, cmonth, cday);
1531 slice->etime.GetDate(eyear, emonth, eday);
1532 slice->ctime.GetTime(chour, cmin, csec);
1533 slice->etime.GetTime(ehour, emin, esec);
1535 sprintf(buf, " | Created at %02d/%02d/%02d %02d:%02d:%02d, Modified at %02d/%02d/%02d %02d:%02d:%02d", cyear, cmonth, cday, chour, cmin,
1536 csec, eyear, emonth, eday, ehour, emin, esec);
1538 edit_slice_to->value(status_line.c_str());
1539 edit_slice_w->show();
1543 Function {x11_ui::notes_module_edit(sfinx_note_t *n)} {return_type void
1546 sfinx_note_t *note = new sfinx_note_t;
1548 note->tid(SFINX_NOTES_MODULE_EDIT);
1549 edit_note_w->user_data((void *)note);
1551 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
1552 note->etime.GetDate(eyear, emonth, eday);
1553 note->etime.GetTime(ehour, emin, esec);
1554 note->ctime.GetDate(cyear, cmonth, cday);
1555 note->ctime.GetTime(chour, cmin, csec);
1556 sprintf(buf, "Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", cday, cmonth, cyear,
1557 chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
1558 edit_note_to->value(buf);
1559 note_name_i->value(note->name.c_str());
1560 note_name_i->take_focus();
1561 note_url_i->value(note->url.c_str());
1562 note_text_i->value(note->text.c_str());
1564 note_mtag_b->user_data(&(note->mtag));
1565 note_mtag_b->copy_label((note->mtag.name + " [ " + note->mtag.description + " ]").c_str());
1566 note_mtag_b->redraw();
1568 note_tags_br->clear();
1569 for (u32_t i = 0; i < note->tags.size(); i++) {
1570 string s = note->tags[i].name + " [ " + note->tags[i].description + " ]";
1571 note_tags_br->add(s.c_str(), &(note->tags[i]));
1573 edit_note_w->label("Edit Note");
1574 edit_note_w->show();
1578 Function {x11_ui::notes_module_reply(sfinx_string_t *classify_error)} {return_type void
1581 if (classify_error->size() == 1) {
1582 ::fill_objects_tree(notes_tree, 1 << SFINX_NOTE_OBJECT, 0, 1); // fluid bugs if any default params exists !
1583 edit_note_w->hide();
1585 fl_alert(classify_error->c_str());
1589 Function {x11_ui::files_module_edit_reply(sfinx_string_t *classify_error)} {open return_type void
1592 if (classify_error->size() == 1) {
1593 if (current_file.tid() != SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
1594 ::fill_objects_tree(files_tree, (1 << SFINX_FILE_OBJECT), 0, 1); // fluid bugs if any default params exists !
1596 app->sfinx.send(current_file);
1597 classify_file_w->hide();
1599 fl_alert(classify_error->c_str());
1603 Function {x11_ui::files_module_edit(sfinx_file_t *f)} {return_type void
1606 static sfinx_file_t file;
1609 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
1610 file.etime.GetDate(eyear, emonth, eday);
1611 file.etime.GetTime(ehour, emin, esec);
1612 file.ctime.GetDate(cyear, cmonth, cday);
1613 file.ctime.GetTime(chour, cmin, csec);
1614 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,
1615 chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
1617 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, path);
1618 string t = "URL: " + path + current_file.name + "/" + file.name + " | " + file.mimetype + " | Size: " + buf;
1619 classify_file_to->value(t.c_str());
1620 file_title_i->value(file.title.c_str());
1621 file_name_i->value(file.name.c_str());
1622 // save orig file name
1623 file.orig_name = file.name;
1624 file.tid(SFINX_FILES_MODULE_EDIT_FILE); // edit file
1625 file_title_i->take_focus();
1626 file_authority_i->value(file.authority.c_str());
1627 file_description_i->value(file.description.c_str());
1628 file_comments_i->value(file.comments.c_str());
1629 sorted_location_b->value(file.sorted_location);
1630 file_compress_b->value(file.store_compressed);
1631 file_gen_csum_b->value(file.generate_csum);
1632 file_mtag_b->copy_label((file.mtag.name + " [ " + file.mtag.description + " ]").c_str());
1633 file_mtag_b->user_data(&file.mtag);
1634 file_tags_br->clear();
1635 for (u32_t i = 0; i < file.tags.size(); i++) {
1636 string s = file.tags[i].name + " [ " + file.tags[i].description + " ]";
1637 file_tags_br->add(s.c_str(), &(file.tags[i]));
1639 classify_file_w->user_data((void *)&file);
1640 classify_file_w->label("Edit File");
1641 classify_file_w->show();
1645 Function {x11_ui::search_browser(sfinx_pair_vector_t *r)} {return_type void
1648 search_browser_br->clear();
1650 search_browser_br->add("Sfinx has no data for this query");
1653 goto_page_ch->clear();
1654 /*for (u32_t i = 1; i < 50; i++) {
1656 sprintf(b, "%d", i);
1657 goto_page_ch->add(b, 0, 0, (void *)i);
1658 // Fl_Menu_Item *item = (Fl_Menu_Item *)(goto_page_ch->menu() + n);
1659 // item->color(FL_GREEN);
1661 goto_page_ch->value(0);
1662 //goto_page_ch->selection_color(FL_GREEN);
1665 for (u32_t i = 0; i < r->len(); i++) {
1666 sfinx_pair_t *p = r->find(i);
1670 if (!p->get(i, &el))
1674 prepare_search_info(el, inf);
1675 string::size_type pos = 0, found;
1676 while ((found = inf.find('\\n', pos)) != string::npos) {
1677 string line(inf, pos, found - pos);
1678 search_browser_br->add(line.c_str());
1681 search_browser_br->add("@-");
1684 search_browser_w->show();
1688 Function {x11_ui::prepare_search_info(sfinx_t *el, string &inf)} {return_type void
1690 code {sfinx_file_t *f;
1691 switch (el->tid()) {
1692 case SFINX_ELEMENT_FILE:
1693 f = (sfinx_file_t *)el;
1694 inf = "\\nType: File\\n";
1695 inf.append("Slice Hierarchy: " + app->slice_hierarchy(f->mtag.id) + "\\n");
1696 /* if (f->slices.size()) {
1697 inf.append("Additional Slices : ");
1698 for (u32_t i = 0; i < f->slices.size(); i++) {
1701 inf.append(app->slice_name(f->slices[i]));
1705 inf.append("Title: " + f->title + "\\n");
1706 inf.append("Authority: " + f->authority + "\\n");
1707 inf.append("Description: " + f->description + "\\n");
1708 inf.append("Comments: " + f->comments + "\\n");
1709 inf.append("Name: " + f->name + "\\n");
1711 sprintf(buf, "%llu bytes\\n", f->fsize);
1712 inf.append("Size: ");
1715 inf.append("Csum: " + f->csum + "\\n");
1716 sprintf(buf, "%llu bytes\\n", f->compressed_fsize);
1717 inf.append("Compressed Size: ");
1719 if (f->compressed_csum.size())
1720 inf.append("Compressed Csum: " + f->compressed_csum + "\\n");
1721 int year, month, day, hour, min, sec;
1722 f->ctime.GetDate(year, month, day);
1723 f->ctime.GetTime(hour, min, sec);
1724 sprintf(buf, "Create Entry Time: %02d/%02d/%04d %02d:%02d:%02d\\n", day, month, year, hour, min, sec);
1726 f->etime.GetDate(year, month, day);
1727 f->etime.GetTime(hour, min, sec);
1728 sprintf(buf, "Edit Entry Time: %02d/%02d/%04d %02d:%02d:%02d\\n", day, month, year, hour, min, sec);
1733 debug("Can't fill element info !");
1738 Function {x11_ui::fill_objects_tree()} {open return_type void
1741 Fl_Toggle_Tree *tree = fill_tree;
1742 u32_t mask = fill_tree_mask;
1745 mask = SFINX_SLICE_OBJECT;
1748 tree->draw_lines(1);
1749 tree->alternate_color(FL_LIGHT2);
1750 tree->trim_color(FL_LIGHT1);
1751 tree->edit_on_reselect(0);
1752 sfinx_slice_t *slice;
1753 Fl_Toggle_Node *node;
1754 u32_t max_name_len = 0;
1755 for (u32_t i = 0; i < app->slices.len(); i++) {
1756 slice = app->slices.get(i);
1757 if (slice == fill_tree_except)
1759 //debug("slice name - %s, id - %lld, parent_id - %lld", slice->name(), slice->id, slice->parent_id);
1760 string name = slice->name() + string(" [ ") +
1761 slice->description() + string(" ]");
1762 // replace \\n with spaces
1763 string filt_elems( "\\n");
1764 string::size_type pos = 0;
1765 while (( pos = name.find_first_of(filt_elems, pos)) != string::npos)
1766 name.replace(pos, 1, string(" "));
1767 if (name.size() > max_name_len)
1768 max_name_len = name.size();
1769 if (!slice->parent_id) {
1770 node = tree->add_sub((char *)name.c_str(), 1, &slice_pixmap, to_voidp(slice));
1771 if (fill_tree_mask & ((1 << SFINX_NOTE_OBJECT) | (1 << SFINX_FILE_OBJECT))) {
1774 for (u32_t x = 0; x < slice->objs.size(); x++) {
1775 switch (slice->objs[x].type) {
1776 case SFINX_NOTE_OBJECT:
1777 if (fill_tree_mask & (1 << SFINX_NOTE_OBJECT))
1778 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, ¬e_pixmap,
1779 to_voidp(&(slice->objs[x])));
1781 case SFINX_FILE_OBJECT:
1782 if (fill_tree_mask & (1 << SFINX_FILE_OBJECT))
1783 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, &file_pixmap,
1784 to_voidp(&(slice->objs[x])));
1787 debug("unsupported fill tree type %d", slice->objs[x].type);
1790 tree->traverse_up();
1794 node = tree->traverse_start();
1796 sfinx_slice_t *s = (sfinx_slice_t *) node->user_data();
1797 if (s->id == slice->parent_id)
1799 node = tree->traverse_forward();
1803 node = tree->add_sub((char *)name.c_str(), 1, &slice_pixmap, to_voidp(slice));
1804 if (fill_tree_mask & ((1 << SFINX_NOTE_OBJECT) | (1 << SFINX_FILE_OBJECT))) {
1807 for (u32_t x = 0; x < slice->objs.size(); x++) {
1808 switch (slice->objs[x].type) {
1809 case SFINX_NOTE_OBJECT:
1810 if (fill_tree_mask & (1 << SFINX_NOTE_OBJECT))
1811 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, ¬e_pixmap,
1812 to_voidp(&(slice->objs[x])));
1814 case SFINX_FILE_OBJECT:
1815 if (fill_tree_mask & (1 << SFINX_FILE_OBJECT))
1816 tree->add_sub((char *)(slice->objs[x].name + slice->objs[x].description).c_str(), 0, &file_pixmap,
1817 to_voidp(&(slice->objs[x])));
1820 debug("unsupported fill tree type %d", slice->objs[x].type);
1823 tree->traverse_up();
1826 } // node not found - just ignore
1829 s32_t width = max_name_len * 8;
1830 // need to count depth for width update
1831 Fl_Scroll_Resize *tree_scroll = (Fl_Scroll_Resize *) tree->user_data();
1832 if (!tree_scroll) // he, forgot to set ;)
1834 tree->resize(tree->x(), tree->y(), width > tree_scroll->w() ? width : tree_scroll->w(), tree->h());
1836 //tree_scroll->redraw();
1837 // try to select previous node
1838 //node = slices_tree->find(to_voidp(current_slice_id));
1840 // slices_tree->select_range(node, node);
1844 Function {x11_ui::fill_unsorted_files_tree(sfinx_files_vector_t *tree_)} {return_type void
1847 static sfinx_files_vector_t tree;
1849 files_module_tree_br->user_data((void *)&tree);
1850 files_module_tree_br->clear();
1852 u32_t files = 0, dirs = 0;
1853 // set parent dir id
1854 if (tree.files.size())
1855 current_file.mtag.id = tree.files[0]->compressed_fsize;
1856 for (u32_t i = 0; i < tree.files.size(); i++) {
1857 if (tree.files[i]->is_directory)
1858 strcpy(buf, "\\t@b@.");
1861 strncat(buf, tree.files[i]->name.c_str(), 50);
1863 if (tree.files[i]->is_directory) {
1864 strcpy(dir_len, "\\t@b@.< DIR >\\t");
1867 sprintf(dir_len, "\\t%llu\\t", tree.files[i]->fsize);
1870 strcat(buf, dir_len);
1871 int cyear, cmonth, cday, chour, cmin, csec;
1872 tree.files[i]->ctime.GetDate(cyear, cmonth, cday);
1873 tree.files[i]->ctime.GetTime(chour, cmin, csec);
1874 sprintf(dir_len, "%02d/%02d/%04d %02d:%02d:%02d\\t", cday, cmonth, cyear, chour, cmin, csec);
1875 strcat(buf, dir_len);
1876 strcat(buf, tree.files[i]->mimetype.c_str());
1877 files_module_tree_br->add(buf);
1879 files_module_tree_br->redraw();
1881 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, root);
1882 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,
1883 (dirs == 1) ? "y" : "ies");
1884 files_module_status_to->value(buf);
1885 files_module_status_to->redraw();
1886 // this is unsorted tree
1887 select_files_tree_b->user_data(0);
1888 select_files_tree_b->label("Show Sorted");
1889 select_files_tree_b->redraw();
1890 files_tree_scroll->hide();
1891 files_module_w->resizable(files_module_tree_br);
1892 files_module_tree_br->show();
1893 files_module_w->redraw();
1897 Function {x11_ui::fill_preferences()} {return_type void
1901 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, t);
1902 config_files_module_unsorted_path_i->value(t.c_str());
1903 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, t);
1904 config_files_module_sorted_path_i->value(t.c_str());
1905 app->files_module_conf.get(FILES_MODULE_DESC_FILE_NAME, t);
1906 config_files_module_desc_file_name_i->value(t.c_str());
1907 u32_t gen_desc_files;
1908 app->files_module_conf.get(FILES_MODULE_DESC_FILE_ENABLE, &gen_desc_files);
1909 gen_desc_files_b->value(gen_desc_files);
1913 Function {x11_ui::log(int level, const char *fmt, ...)} {return_type void
1915 code {char buf[10240];
1916 const char *level_str;
1921 ::va_start(args, fmt);
1924 case SFINX_LOG_NOTICE:
1925 level_str = "NOTICE";
1927 case SFINX_LOG_WARN:
1930 case SFINX_LOG_ERROR:
1931 level_str = "ERROR";
1933 case SFINX_LOG_FATAL:
1934 level_str = "FATAL";
1937 level_str = "UNKN_LEVEL";
1940 strcpy(buf, level_str);
1942 ::vsnprintf(buf + strlen(level_str) + 2, sizeof(buf) - (strlen(level_str) + 2), fmt, args);
1945 log_m.leaveMutex();} {}
1948 Function {x11_ui::progress(sfinx_progress_t *p)} {return_type void
1951 static char buf[128];
1952 switch (p->status()) {
1953 case SFINX_PROGRESS_START:
1954 progress_l->label(p->label());
1955 strcpy(buf, p->strvalue());
1956 progress_bar->label(buf);
1957 progress_bar->minimum(0);
1958 progress_bar->maximum(p->max());
1959 progress_bar->value(p->value());
1961 progress_w->redraw();
1963 case SFINX_PROGRESS_END:
1966 case SFINX_PROGRESS_NONE:
1973 Function {x11_ui::alert(sfinx_string_t *alert)} {return_type void
1976 if (alert->size() != 1)
1977 fl_alert(alert->c_str());