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>} {public global
20 decl {\#include <scroll.H>} {public global
23 decl {Fl_Toggle_Tree *config_tree;} {global
26 decl {Fl_Toggle_Tree *slices_tree;} {global
29 decl {Fl_Toggle_Tree *select_slice_tree;} {global
32 decl {u32_t current_slice_id, selected_slice_id;} {global
35 decl {string current_slice_name;} {global
38 decl {sfinx_file_t current_files_module_tree_path(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);} {}
40 Function {relink_slice_action()} {private return_type void
42 code {sfinx_slice_t slice(SFINX_SLICE_RELINK);
43 slice.slice_id = current_slice_id;
44 slice.parent_slice_id = selected_slice_id; //(u32_t) node->user_data();
45 slice.name(""); // for size update
46 app->sfinx.send(slice);
47 select_slice_w->hide();
48 app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);} {}
51 Function {select_file_main_slice_action()} {private return_type void
53 code {//debug("selected slice - %d [%s]", current_slice_id, current_slice_name.c_str());
54 file_main_slice_b->user_data(to_voidp(current_slice_id));
56 l = current_slice_name;
57 file_main_slice_b->label(l.c_str());
58 file_main_slice_b->redraw();
59 // check for additional slices if it is here - remove it
60 for (int i = 1; i <= file_additional_slices_br->size(); i++) {
61 if (file_additional_slices_br->data(i) == to_voidp(current_slice_id)) {
62 file_additional_slices_br->remove(i);
68 Function {select_file_additional_slice_action()} {private return_type void
70 code {if (to_voidp(current_slice_id) == file_main_slice_b->user_data()) // already set as main slice
72 for (int i = 1; i <= file_additional_slices_br->size(); i++) {
73 if (file_additional_slices_br->data(i) == to_voidp(current_slice_id))
76 file_additional_slices_br->add(current_slice_name.c_str(), to_voidp(current_slice_id));
77 file_additional_slices_br->redraw();} {}
80 Function {search_add_slice_action()} {private return_type void
82 code {for (int i = 1; i <= search_slices_br->size(); i++) {
83 if (search_slices_br->data(i) == to_voidp(current_slice_id))
86 search_slices_br->add(current_slice_name.c_str(), to_voidp(current_slice_id));
87 search_slices_br->redraw();} {}
90 Function {slices_tree_cb(Fl_Widget *, void *)} {private return_type void
92 code {Fl_Toggle_Node *node = slices_tree->selected();
95 current_slice_id = from_voidp(node->user_data());
96 current_slice_name = node->label();
97 if (!Fl::event_clicks())
99 void (*select_slice_action)(void) = (void (*)())(slices_w->user_data());
100 if (select_slice_action) {
102 slices_w->user_data(0);
103 select_slice_action();
107 Function {select_slice_tree_cb(Fl_Widget *, void *)} {private return_type void
109 code {if (!Fl::event_clicks())
111 select_slice_b->do_callback();} {}
114 Function {write_preferences()} {private return_type void
116 code {app->server_name = config_sfinx_server_name_i->value();
117 app->files_module_conf.clear();
118 app->files_module_conf.add(FILES_MODULE_UNSORTED_PATH,
119 config_files_module_unsorted_path_i->value());
120 app->files_module_conf.add(FILES_MODULE_SORTED_TREE_PATH,
121 config_files_module_sorted_path_i->value());
122 app->files_module_conf.add(FILES_MODULE_DESC_FILE_NAME,
123 config_files_module_desc_file_name_i->value());
124 app->files_module_conf.add(FILES_MODULE_DESC_FILE_ENABLE,
125 gen_desc_files_b->value());
126 app->write_preferences();} {}
129 Function {config_tree_cb(Fl_Widget *, void *)} {private return_type void
131 code {static Fl_Group *prev_group;
132 Fl_Toggle_Node *node = config_tree->selected();
134 Fl_Group *gr = *((Fl_Group **)(node->user_data()));
139 //config_tree->unselect();
143 Function {fill_config_tree()} {private return_type void
145 code {config_tree->add_next("Connection", 0, 0, (void *)&config_connection_gr);
146 config_tree->add_next("Files Module", 0, 0, (void *)&config_files_module_gr);
147 config_tree->add_next("Confirmation", 0, 0, (void *)&config_confirmation_gr);
148 config_tree->callback(config_tree_cb);
149 config_tree->edit_on_reselect(0);} {}
152 Function {x11_ui::init()} {open private return_type void
156 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
157 F::shutdown(0);} open
158 xywh {34 45 940 365} type Double hide
165 xywh {0 0 67 22} labeltype ENGRAVED_LABEL
168 label {Connect to ...}
169 xywh {0 0 34 22} shortcut 0x80063 labeltype ENGRAVED_LABEL deactivate
172 label {Connect to default server}
173 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
176 label {Disconnect from Sfinx}
177 xywh {10 10 34 22} labeltype ENGRAVED_LABEL deactivate
180 label {Connection Info}
181 xywh {20 20 34 22} shortcut 0x80069 labeltype ENGRAVED_LABEL deactivate
185 xywh {30 30 34 22} labeltype ENGRAVED_LABEL deactivate divider
189 callback {app->read_preferences();
190 config_sfinx_server_name_i->value(app->server_name.c_str());
191 preferences_w->show();}
192 xywh {30 30 34 22} shortcut 0x80070 labeltype ENGRAVED_LABEL divider
196 callback {if (fl_choice("Really quit ?", "No", "Yes", 0L))
198 xywh {20 20 34 22} shortcut 0x80078 labeltype ENGRAVED_LABEL
203 xywh {10 10 67 22} labeltype ENGRAVED_LABEL
207 callback {if (!app->connected()) {
208 fl_message("Not connected to Sfinx Server !");
211 if (app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0))
214 xywh {10 10 34 22} shortcut 0x61 labeltype ENGRAVED_LABEL deactivate
218 callback {if (!app->connected()) {
219 fl_message("Not connected to Sfinx Server !");
222 if (app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0))
225 xywh {10 10 34 22} shortcut 0x73 labeltype ENGRAVED_LABEL
228 label {Knowledge Module}
229 callback {if (!app->connected()) {
230 fl_message("Not connected to Sfinx Server !");
233 xywh {40 40 34 22} shortcut 0x6b labeltype ENGRAVED_LABEL deactivate
237 callback {if (!app->connected()) {
238 fl_message("Not connected to Sfinx Server !");
241 xywh {40 40 34 22} shortcut 0x74 labeltype ENGRAVED_LABEL deactivate
245 callback {if (!app->connected()) {
246 fl_message("Not connected to Sfinx Server !");
249 xywh {40 40 34 22} shortcut 0x6d labeltype ENGRAVED_LABEL deactivate
253 callback {if (!app->connected()) {
254 fl_message("Not connected to Sfinx Server !");
257 xywh {50 50 34 22} shortcut 0x63 labeltype ENGRAVED_LABEL deactivate
261 callback {if (!app->connected()) {
262 fl_message("Not connected to Sfinx Server !");
265 xywh {40 40 34 22} shortcut 0x65 labeltype ENGRAVED_LABEL deactivate
269 callback {if (!app->connected()) {
270 fl_message("Not connected to Sfinx Server !");
273 app->sfinx.send(SFINX_FILES_MODULE_CONF_REQUEST, (u8_t) 0);
274 if (app->sfinx.send(current_files_module_tree_path))
276 files_module_w->show();}
277 xywh {20 20 34 22} shortcut 0x66 labeltype ENGRAVED_LABEL
281 callback {if (!app->connected()) {
282 fl_message("Not connected to Sfinx Server !");
285 xywh {30 30 34 22} shortcut 0x6e labeltype ENGRAVED_LABEL deactivate
290 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
293 label {Browser && Searcher}
294 callback {if (!app->connected()) {
295 fl_message("Not connected to Sfinx Server !");
298 search_i->take_focus();
300 xywh {30 30 34 22} shortcut 0x62 labeltype ENGRAVED_LABEL
304 callback {if (!app->connected()) {
305 fl_message("Not connected to Sfinx Server !");
308 xywh {30 30 34 22} shortcut 0x72 labeltype ENGRAVED_LABEL deactivate divider
312 callback {if (!app->connected()) {
313 fl_message("Not connected to Sfinx Server !");
316 xywh {40 40 34 22} shortcut 0x40061 labeltype ENGRAVED_LABEL deactivate
319 label {Knowledge Tracer}
320 callback {if (!app->connected()) {
321 fl_message("Not connected to Sfinx Server !");
324 xywh {40 40 34 22} shortcut 0x4006b labeltype ENGRAVED_LABEL deactivate
327 label {Indexing machine}
328 callback {if (!app->connected()) {
329 fl_message("Not connected to Sfinx Server !");
332 xywh {30 30 34 22} shortcut 0x40069 labeltype ENGRAVED_LABEL deactivate
335 label {Check Sfinx DB}
336 callback {if (!app->connected()) {
337 fl_message("Not connected to Sfinx Server !");
340 xywh {40 40 34 22} shortcut 0x40064 labeltype ENGRAVED_LABEL deactivate
344 callback {if (!app->connected()) {
345 fl_message("Not connected to Sfinx Server !");
348 xywh {30 30 34 22} shortcut 0x40062 labeltype ENGRAVED_LABEL deactivate divider
351 label {Clear log window}
352 callback {log_br->clear();}
353 xywh {30 30 34 22} shortcut 0x10063 labeltype ENGRAVED_LABEL
358 xywh {20 20 67 22} labeltype ENGRAVED_LABEL deactivate
362 xywh {20 20 67 22} labeltype ENGRAVED_LABEL
366 xywh {30 30 34 22} shortcut 0xffbe labeltype ENGRAVED_LABEL deactivate divider
370 callback {about_w->show();}
371 xywh {30 30 34 22} shortcut 0x80061 labeltype ENGRAVED_LABEL
375 Fl_Output status_bar_o {
376 tooltip Status xywh {0 347 940 20} box PLASTIC_UP_BOX color 31 deactivate
379 xywh {-1 21 943 326} type Select color 31 labelfont 4 textfont 4
382 Fl_Window preferences_w {
384 xywh {215 308 742 373} type Double color 31 hide
388 callback {preferences_w->hide();}
389 xywh {390 330 112 25} labeltype ENGRAVED_LABEL
393 callback {write_preferences();
394 preferences_w->hide();}
395 xywh {572 330 112 25} labeltype ENGRAVED_LABEL
397 Fl_Scroll prefs_tree_scroll {
398 xywh {10 29 173 283} type VERTICAL_ALWAYS box ENGRAVED_FRAME color 28
399 code0 {config_tree = new Fl_Toggle_Tree(12, 12, prefs_tree_scroll->w() - prefs_tree_scroll->scrollbar.w(), 10);}
400 code1 {fill_config_tree();}
402 Fl_Group config_connection_gr {open
403 xywh {183 19 535 283} box ENGRAVED_FRAME hide
405 Fl_Input config_sfinx_server_name_i {
406 label {Sfinx Server Name}
407 xywh {273 89 375 26} color 29 labeltype ENGRAVED_LABEL align 1
410 label {Minimum Auth Level}
411 xywh {227 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
414 label {User Name && Passsword}
423 label {Minimum Debug Level}
424 xywh {227 230 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
443 label {Warning Level}
455 label {Critical Level}
464 label {Minimum Crypt Level}
465 xywh {476 179 211 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5 deactivate
477 Fl_Group config_files_module_gr {
478 xywh {193 29 535 283} box ENGRAVED_FRAME hide
480 Fl_Input config_files_module_unsorted_path_i {
481 label {Unsorted files path on Sfinx server}
482 xywh {283 68 375 26} color 29 labeltype ENGRAVED_LABEL align 1
484 Fl_Input config_files_module_sorted_path_i {
485 label {Sorted file tree path on Sfinx server}
486 xywh {283 128 375 26} color 29 labeltype ENGRAVED_LABEL align 1
488 Fl_Check_Button gen_desc_files_b {
489 label {Generate description files}
490 xywh {209 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
492 Fl_Input config_files_module_desc_file_name_i {
493 label {Description file name}
494 xywh {283 189 375 26} color 29 labeltype ENGRAVED_LABEL align 1
496 Fl_Check_Button process_files_mime_type_b {
497 label {Detect files MIME type}
498 xywh {472 233 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
501 Fl_Group config_confirmation_gr {
502 xywh {183 19 535 283} box ENGRAVED_FRAME hide
504 Fl_Check_Button exit_confirm_b {
506 xywh {216 45 204 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL deactivate
510 Fl_Window select_slice_w {
511 label {Select Sfinx Slice}
512 xywh {157 449 730 370} type Double color 31 hide modal
516 callback {select_slice_w->hide();}
517 xywh {594 312 112 25} labeltype ENGRAVED_LABEL
519 Fl_Button select_slice_b {
521 callback {Fl_Toggle_Node *node = select_slice_tree->selected();
524 selected_slice_id = from_voidp(node->user_data());
525 void (*select_slice_action)(void) = (void (*)())(select_slice_b->user_data());
526 select_slice_action();}
527 xywh {21 312 542 25} labeltype ENGRAVED_LABEL
529 Fl_Scroll select_slice_tree_scroll {open
530 xywh {15 15 702 280} box ENGRAVED_FRAME color 28
531 code0 {select_slice_tree = new Fl_Toggle_Tree(12, 12, select_slice_tree_scroll->w(), 10);}
532 code1 {select_slice_tree->callback(select_slice_tree_cb);}
533 code2 {select_slice_w->resizable(select_slice_tree_scroll);}
534 code3 {select_slice_tree_scroll->resizable(select_slice_tree);}
535 class Fl_Scroll_Resize
537 Fl_Output select_slice_status_to {
538 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31 deactivate
543 xywh {172 126 730 370} type Double color 31 hide modal
547 callback {slices_w->hide();}
548 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
552 callback {Fl_Toggle_Node *node = slices_tree->selected();
555 if (current_slice_id == 1) // Root Slice can't be deleted
557 // set safe deletion mode
558 slice_deletion_type_ch->value(0);
559 data_deletion_type_ch->value(0);
560 delete_sfinx_slice_to->value(current_slice_name.c_str());
561 delete_slice_w->show();}
562 xywh {456 312 128 25} labeltype ENGRAVED_LABEL
564 Fl_Scroll slices_tree_scroll {open
565 xywh {15 15 702 280} box ENGRAVED_FRAME color 28
566 code0 {slices_tree = new Fl_Toggle_Tree(12, 12, slices_tree_scroll->w() /*- slices_tree_scroll->scrollbar.w()*/, 10);}
567 code1 {slices_tree->callback(slices_tree_cb);}
568 code2 {slices_w->resizable(slices_tree_scroll);}
569 code3 {slices_tree_scroll->resizable(slices_tree);}
570 class Fl_Scroll_Resize
574 callback {Fl_Toggle_Node *node = slices_tree->selected();
577 edit_slice_w->user_data(node->user_data());
578 app->sfinx.send(SFINX_EDIT_SLICE_REQUEST, (u32_t)from_voidp(node->user_data()));
579 edit_slice_w->label("Edit Sfinx Slice");}
580 xywh {305 312 128 25} labeltype ENGRAVED_LABEL
582 Fl_Output slices_status_to {
583 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31 deactivate
587 callback {Fl_Toggle_Node *node = slices_tree->selected();
589 fl_alert("Please select slice connection point !");
592 edit_slice_w->user_data(0); // new slice
593 slice_name_i->value(0);
594 slice_directory_i->value(0);
595 slice_name_i->take_focus();
596 slice_description_i->value(0);
597 edit_slice_to->value(string(string("Parent slice: ") + current_slice_name).c_str());
598 edit_slice_w->label("New Sfinx Slice");
599 edit_slice_w->show();} selected
600 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
604 callback {Fl_Toggle_Node *node = slices_tree->selected();
607 if (app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST_EXCEPT, (u32_t)current_slice_id))
609 select_slice_b->user_data((void *)relink_slice_action);
610 select_slice_w->show();}
611 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
614 Fl_Window edit_slice_w {
615 label {Edit Sfinx Slice}
616 xywh {276 319 595 330} type Double color 31 hide modal
618 Fl_Input slice_name_i {
620 xywh {47 35 496 26} color 29 labeltype ENGRAVED_LABEL align 1
622 Fl_Input slice_directory_i {
623 label {Slice Directory}
624 xywh {47 93 496 26} color 29 labeltype ENGRAVED_LABEL align 1
626 Fl_Input slice_description_i {
627 label {Slice Description}
628 xywh {34 158 523 89} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
630 Fl_Return_Button {} {
632 callback {if (!slice_name_i->size()) {
633 fl_message("Missing slice name !");
636 u32_t slice_id = from_voidp(edit_slice_w->user_data());
639 slice.id(SFINX_EDIT_SLICE);
641 slice.id(SFINX_NEW_SLICE);
642 slice.name(slice_name_i->value());
643 slice.directory(slice_directory_i->value());
644 slice.description(slice_description_i->value());
645 slice.slice_id = slice_id;
646 slice.parent_slice_id = current_slice_id;
647 app->sfinx.send(slice);
648 edit_slice_w->hide();
649 app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);}
650 xywh {111 270 112 25} labeltype ENGRAVED_LABEL
654 callback {edit_slice_w->hide();}
655 xywh {359 270 112 25} labeltype ENGRAVED_LABEL
657 Fl_Output edit_slice_to {
658 xywh {0 312 598 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
661 Fl_Window delete_slice_w {
662 label {Delete Sfinx Slice}
663 xywh {252 500 388 223} type Double color 31 hide modal
667 callback {delete_slice_w->hide();}
668 xywh {238 175 112 25} labeltype ENGRAVED_LABEL
672 callback {// need to confirm deletion ?!
673 bool recursivly = slice_deletion_type_ch->value();
675 app->sfinx.send(data_deletion_type_ch->value() ?
676 (recursivly ? SFINX_DELETE_SLICE_ASSOC_DATA_RECURSIVLY : SFINX_DELETE_SLICE_ASSOC_DATA) :
677 (recursivly ? SFINX_DELETE_SLICE_MARK_DATA_UNSORTED_RECURSIVLY : SFINX_DELETE_SLICE_MARK_DATA_UNSORTED),
678 (u32_t)current_slice_id);
679 app->sfinx.send(recursivly ? SFINX_DELETE_SLICE_RECURSIVLY : SFINX_DELETE_SLICE_WITH_REATTACH,
680 (u32_t)current_slice_id);
681 delete_slice_w->hide();
682 app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);}
683 xywh {39 175 112 25} labeltype ENGRAVED_LABEL
685 Fl_Output delete_sfinx_slice_to {
686 label {Please confirm deletion of the slice}
687 xywh {35 31 330 26} box ENGRAVED_FRAME color 29 labeltype ENGRAVED_LABEL align 1
689 Fl_Choice slice_deletion_type_ch {
690 label {Slice && Data Deletion Type}
691 xywh {73 82 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5
694 label {Attach subslices to parent}
698 label {Delete all subslices recursivly}
702 Fl_Choice data_deletion_type_ch {
703 label {Associated Data Deletion Type}
704 xywh {73 132 240 23} down_box BORDER_BOX color 48 labeltype ENGRAVED_LABEL align 5
707 label {Mark all data 'Unsorted'}
711 label {Delete all data}
716 Fl_Window progress_w {
718 xywh {286 302 464 98} type Double hide
720 Fl_Progress progress_bar {
722 xywh {22 46 422 27} box PLASTIC_DOWN_BOX selection_color 2
725 label {Doing some work ...}
726 xywh {66 10 330 25} box FLAT_BOX labeltype ENGRAVED_LABEL
729 Fl_Window files_module_w {
731 xywh {159 89 733 370} type Double color 31 hide resizable
735 callback {files_module_w->hide();}
736 xywh {605 312 112 25} labeltype ENGRAVED_LABEL
738 Fl_Output files_module_status_to {
739 xywh {0 349 733 21} box PLASTIC_UP_BOX color 31
741 Fl_Button classify_file_b {
743 callback {int n = files_module_tree_br->value();
746 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
747 //debug("slice_id - %d, parent_id - %d, name - %s", current_files_module_tree_path.file_id, current_files_module_tree_path.main_slice_id,
748 // file->name.c_str());
750 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
751 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
753 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, path);
755 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
756 file->etime.GetDate(eyear, emonth, eday);
757 file->etime.GetTime(ehour, emin, esec);
758 file->ctime.GetDate(cyear, cmonth, cday);
759 file->ctime.GetTime(chour, cmin, csec);
760 sprintf(buf, "%llu bytes | Modified: %02d/%02d/%04d %02d:%02d:%02d | Last Status Changed: %02d/%02d/%04d %02d:%02d:%02d", file->fsize, cday, cmonth,
761 cyear, chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
762 string t = "URL: " + path + current_files_module_tree_path.name + "/" + file->name + " | " + file->mimetype + " | Size: " + buf;
763 classify_file_to->value(t.c_str());
764 file_title_i->value(0);
765 file_name_i->value(file->name.c_str());
766 // save orig file name
767 file->orig_name = file->name;
768 file->id(SFINX_FILES_MODULE_CLASSIFY_REQUEST); // new file
769 file_title_i->take_focus();
770 file_authority_i->value(0);
771 file_description_i->value(0);
772 file_comments_i->value(0);
773 sorted_location_b->value(1);
774 file_compress_b->value(1);
775 file_gen_csum_b->value(1);
776 file_main_slice_b->label("Main Slice (Not Set)");
777 file_main_slice_b->user_data(0); // ÔÕÔÁ ÈÒÁÎÉÔÓÑ slice_id
778 file_additional_slices_br->clear();
779 classify_file_w->user_data((void *)file);
780 classify_file_w->show();}
781 xywh {21 312 112 25} labeltype ENGRAVED_LABEL
785 xywh {154 312 128 25} labeltype ENGRAVED_LABEL
787 Fl_Browser files_module_tree_br {
788 callback {if (!Fl::event_clicks())
790 sfinx_files_vector_t *tree = (sfinx_files_vector_t *) files_module_tree_br->user_data();
791 int n = files_module_tree_br->value();
792 //debug("selected %s file", tree->files[n - 1]->url.c_str());
793 if (tree->files[n - 1]->is_directory) { // ÀÚÅÒ ÓÍÅÎÉÌ ÄÉÒÅËÔÏÒÉÀ
794 // × file_id ÈÒÁÎÉÔÓÑ id ÔÅËÕÝÅÊ ÄÉÒÅËÔÏÒÉÉ-ÓÌÁÊÓÁ × ËÏÔÏÒÏÊ ÎÁÈÏÄÉÍÓÑ/×ÙÂÒÁÌÉ
795 // × main_slice_id - parent_id ÄÉÒÅËÔÏÒÉÉ
796 // ÚÁÈÏÄÉÍ × ÄÉÒÅËÔÏÒÉÀ - ÔÅËÕÝÁÑ ÓÔÁÎÏ×ÉÔÓÑ parent'ÏÍ
797 current_files_module_tree_path.file_id = tree->files[n - 1]->file_id;
798 current_files_module_tree_path.main_slice_id = tree->files[n - 1]->main_slice_id;
799 // × name ÈÒÁÎÉÔÓÑ ×ÅÓØ ÐÕÔØ ÏÔ root location
800 // × orig_name ÔÏÌØËÏ ÉÍÑ ÔÅËÕÝÅÊ
801 string t = current_files_module_tree_path.name.c_str();
802 // current_files_module_tree_path.orig_name = tree->files[n - 1]->name;
803 t += ('/' + tree->files[n - 1]->name);
804 current_files_module_tree_path.name = t;
805 //debug("requesting dir %s", current_files_module_tree_path.c_str());
806 app->sfinx.send(current_files_module_tree_path);
808 if (!(tree->files[n - 1]->file_id)) // classify file
809 classify_file_b->do_callback();
811 // app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0); // prepare for slice_name() calls
812 sfinx_file_t *file = tree->files[n - 1];
813 file->id(SFINX_FILES_MODULE_EDIT_FILE_REQUEST);
814 app->sfinx.send(file);
817 xywh {8 45 716 255} type Multi color 31 resizable
818 code0 {static int widths[] = { 10, 450, 200, 200, 0};}
819 code1 {files_module_tree_br->column_widths(widths);}
823 callback {int n = files_module_tree_br->value();
826 sfinx_file_t *file = ((sfinx_files_vector_t *)files_module_tree_br->user_data())->files[n - 1];
828 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST) {
830 string message = "Deleting \\'" + file->name + "\\'. Are you sure ?";
831 if (fl_choice(message.c_str(), "Yes", "No", 0L))
833 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
834 path += "/" + file->name;
835 sfinx_string_t f(SFINX_FILES_MODULE_UNLINK);
839 // sorted can be marked unsorted or deleted
840 string message = "Delete or Unsort \\'" + file->name + "\\' ?";
841 int res = fl_choice(message.c_str(), "Cancel", "Unsort", "Delete");
844 if (res == 2) { // delete
845 file->id(SFINX_FILES_MODULE_SORTED_UNLINK);
846 app->sfinx.send(file);
848 file->id(SFINX_FILES_MODULE_UNSORT);
849 app->sfinx.send(file);
852 //files_module_tree_br->remove(n);
853 app->sfinx.send(current_files_module_tree_path);}
854 xywh {300 312 112 25} labeltype ENGRAVED_LABEL
856 Fl_Button select_files_tree_b {
858 callback {files_module_tree_br->clear();
859 current_files_module_tree_path.name.clear();
860 current_files_module_tree_path.orig_name.clear();
861 if (select_files_tree_b->user_data()) {
862 select_files_tree_b->user_data(0);
863 select_files_tree_b->label("Sorted tree");
864 current_files_module_tree_path.id(SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST);
865 current_files_module_tree_path.file_id = 0;
867 select_files_tree_b->user_data((void *)1);
868 select_files_tree_b->label("Unsorted tree");
869 current_files_module_tree_path.id(SFINX_FILES_MODULE_SORTED_TREE_REQUEST);
870 current_files_module_tree_path.file_id = 1; // root id
873 select_files_tree_b->redraw();
874 app->sfinx.send(current_files_module_tree_path);}
875 xywh {562 10 128 25} labeltype ENGRAVED_LABEL
879 callback {const char *p = strrchr(current_files_module_tree_path.name.c_str(), '/');
881 current_files_module_tree_path.name.clear();
885 strncat(path, current_files_module_tree_path.name.c_str(), p - current_files_module_tree_path.name.c_str());
886 current_files_module_tree_path.name = path;
887 current_files_module_tree_path.file_id = current_files_module_tree_path.main_slice_id;
889 app->sfinx.send(current_files_module_tree_path);}
890 xywh {35 10 112 25} labeltype ENGRAVED_LABEL
894 callback {app->sfinx.send(current_files_module_tree_path);}
895 xywh {166 10 112 25} labeltype ENGRAVED_LABEL
899 callback {for (int i = 1; i <= files_module_tree_br->size(); i++)
900 files_module_tree_br->select(i);}
901 xywh {295 10 112 25} labeltype ENGRAVED_LABEL
905 callback {files_module_tree_br->deselect();}
906 xywh {428 10 112 25} labeltype ENGRAVED_LABEL
909 Fl_Window classify_file_w {
910 label {Classify File}
911 xywh {76 244 1020 515} type Double color 31 hide modal
915 callback {classify_file_w->hide();}
916 xywh {612 454 112 25} labeltype ENGRAVED_LABEL
918 Fl_Input file_title_i {
920 xywh {16 27 496 26} color 29 labeltype ENGRAVED_LABEL align 1
922 Fl_Input file_authority_i {
924 xywh {16 83 496 26} color 29 labeltype ENGRAVED_LABEL align 1
926 Fl_Input file_description_i {
928 xywh {549 78 447 101} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
930 Fl_Input file_comments_i {
932 xywh {582 220 416 212} type Multiline color 29 labeltype ENGRAVED_LABEL align 1
934 Fl_Output classify_file_to {
935 xywh {0 497 1022 21} box PLASTIC_UP_BOX color 31 labelsize 10 textsize 10
937 Fl_Return_Button {} {
939 callback {if (!file_main_slice_b->user_data()) {
940 fl_alert("You have to select Main Slice for file !");
943 if (!file_name_i->size()) {
944 fl_alert("File must have some name !");
947 sfinx_file_t *file = (sfinx_file_t *)classify_file_w->user_data();
948 // file->id(SFINX_FILES_MODULE_CLASSIFY_REQUEST);
949 file->name = file_name_i->value();
950 file->title = file_title_i->value();
951 file->authority = file_authority_i->value();
952 file->description = file_description_i->value();
953 file->comments = file_comments_i->value();
954 file->sorted_location = sorted_location_b->value();
955 file->store_compressed = file_compress_b->value();
956 file->generate_csum = file_gen_csum_b->value();
957 file->main_slice_id = from_voidp(file_main_slice_b->user_data());
958 file->slices.clear();
959 for (int i = 1; i <= file_additional_slices_br->size(); i++)
960 file->slices.push_back(from_voidp(file_additional_slices_br->data(i)));
961 app->sfinx.send(file);}
962 xywh {243 454 112 25} labeltype ENGRAVED_LABEL
964 Fl_Check_Button sorted_location_b {
965 label {Sorted Location}
966 xywh {15 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
968 Fl_Check_Button file_crypt_b {
970 xywh {15 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
972 Fl_Check_Button file_compress_b {
973 label {Store compressed}
974 xywh {274 132 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
977 xywh {13 205 552 227} box ENGRAVED_FRAME
979 Fl_Button file_main_slice_b {
980 label {Main Slice (Not Set)}
981 callback {app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
982 slices_w->user_data((void *)select_file_main_slice_action);
984 tooltip {File Main Slice} xywh {45 226 489 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
986 Fl_Browser file_additional_slices_br {
987 label {Additional Slices}
988 xywh {26 275 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
990 Fl_Button file_add_slice_b {
992 callback {app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
993 slices_w->user_data((void *)select_file_additional_slice_action);
995 xywh {82 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
997 Fl_Button file_remove_slice_b {
999 callback {for (int i = file_additional_slices_br->size(); i >= 1; i--) {
1000 if (file_additional_slices_br->selected(i))
1001 file_additional_slices_br->remove(i);
1003 xywh {358 391 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1005 Fl_Input file_name_i {
1007 xywh {549 26 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1009 Fl_Check_Button file_gen_csum_b {
1010 label {Generate CSUM}
1011 xywh {274 165 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16
1014 Fl_Window search_w {
1016 xywh {169 380 749 389} type Double color 31 hide modal
1020 callback {search_w->hide();}
1021 xywh {182 347 363 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1023 Fl_Return_Button {} {
1025 callback {sfinx_search_query_t query;
1026 query.pattern = search_i->value();
1027 if (search_in_files_b->value())
1028 query.add_area(SFINX_SEARCH_IN_FILES);
1029 // add restrictions ...
1030 app->sfinx.send(query);}
1031 xywh {539 48 163 25} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1033 Fl_Check_Button search_in_files_b {
1034 label {Search in Files}
1035 xywh {48 96 241 23} box PLASTIC_UP_BOX down_box DOWN_BOX selection_color 15 labeltype ENGRAVED_LABEL align 16 deactivate
1038 xywh {87 141 561 189} box ROUNDED_FRAME
1040 Fl_Browser search_slices_br {
1041 label {Restrict Search by Slices}
1042 xywh {105 173 525 102} type Multi color 46 labeltype ENGRAVED_LABEL align 1
1044 Fl_Button search_add_slice_b {
1046 callback {app->sfinx.send(SFINX_SLICES_MODULE_TREE_REQUEST, (u8_t)0);
1047 slices_w->user_data((void *)search_add_slice_action);
1049 xywh {161 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1052 label {Remove Slice}
1053 callback {for (int i = search_slices_br->size(); i >= 1; i--) {
1054 if (search_slices_br->selected(i))
1055 search_slices_br->remove(i);
1057 xywh {437 289 138 25} box PLASTIC_THIN_UP_BOX labeltype ENGRAVED_LABEL
1060 label {Search for ...}
1061 xywh {46 47 447 26} color 29 labeltype ENGRAVED_LABEL align 1
1064 Fl_Window search_browser_w {
1065 label {Search Browser}
1066 xywh {217 305 854 476} type Double color 31 hide resizable modal
1070 callback {search_browser_w->hide();}
1071 xywh {638 449 187 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1073 Fl_Browser search_browser_br {
1074 xywh {4 4 846 439} type Hold box GTK_THIN_UP_BOX color 44 resizable
1077 label {Previous Page}
1078 xywh {25 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1082 xywh {231 449 169 20} box PLASTIC_ROUND_UP_BOX color 0 labeltype ENGRAVED_LABEL
1084 Fl_Choice goto_page_ch {
1085 label {Current Page }
1086 xywh {531 450 72 20} box PLASTIC_THIN_UP_BOX down_box PLASTIC_THIN_UP_BOX color 44 labeltype ENGRAVED_LABEL
1090 xywh {357 229 374 154} type Double hide
1094 callback {about_w->hide();}
1095 xywh {72 122 226 20} box PLASTIC_ROUND_UP_BOX labeltype ENGRAVED_LABEL
1098 image {../docs/sfinx.jpg} xywh {10 9 130 101}
1102 xywh {203 6 99 33} labeltype EMBOSSED_LABEL labelfont 9 labelsize 32
1105 label {Personal knowledge manager}
1106 xywh {150 40 214 22} labeltype EMBOSSED_LABEL labelcolor 64
1109 label {Copyright (C) 2007 Rus V. Brushkoff}
1110 xywh {150 58 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1113 label {Email: Rus@@Sfinx.Od.UA}
1114 xywh {150 75 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1117 label {http://sfinx.od.ua/index.php?id=sfinx}
1118 xywh {150 93 214 22} labeltype EMBOSSED_LABEL labelfont 8 labelsize 11 labelcolor 56
1121 code {main_w->show();} {}
1124 Function {x11_ui::log(int level, const char *fmt, ...)} {private return_type void
1126 code {char buf[10240];
1127 const char *level_str;
1132 ::va_start(args, fmt);
1135 case SFINX_LOG_NOTICE:
1136 level_str = "NOTICE";
1138 case SFINX_LOG_WARN:
1141 case SFINX_LOG_ERROR:
1142 level_str = "ERROR";
1144 case SFINX_LOG_FATAL:
1145 level_str = "FATAL";
1148 level_str = "UNKN_LEVEL";
1151 strcpy(buf, level_str);
1153 ::vsnprintf(buf + strlen(level_str) + 2, sizeof(buf) - (strlen(level_str) + 2), fmt, args);
1156 log_m.leaveMutex();} {}
1159 Function {x11_ui::fill_slices_tree(sfinx_slice_vector_t *slices)} {private return_type void
1163 slices_tree->clear();
1164 slices_tree->draw_lines(1);
1165 slices_tree->alternate_color(FL_LIGHT2);
1166 slices_tree->trim_color(FL_LIGHT1);
1167 slices_tree->edit_on_reselect(0);
1168 sfinx_slice_t *slice;
1169 Fl_Toggle_Node *node;
1170 u32_t max_name_len = 0;
1171 for (u32_t i = 0; i < slices->len(); i++) {
1172 slice = slices->get(i);
1173 string name = slice->name() + string(" [ ") +
1174 slice->description() + string(" ] ");
1175 // replace \\n with spaces
1176 string filt_elems( "\\n");
1177 string::size_type pos = 0;
1178 while (( pos = name.find_first_of(filt_elems, pos)) != string::npos)
1179 name.replace(pos, 1, string(" "));
1180 if (name.size() > max_name_len)
1181 max_name_len = name.size();
1182 if (!slice->parent_slice_id) {
1183 node = slices_tree->add_sub((char *)name.c_str());
1184 node->user_data(to_voidp(slice->slice_id));
1186 node = slices_tree->find(to_voidp(slice->parent_slice_id));
1188 slices_tree->open(node);
1189 node = slices_tree->add_sub((char *)name.c_str());
1190 node->user_data(to_voidp(slice->slice_id));
1191 } else F::log("fill slices:",
1192 "can't find node for %d parent, slice_id %d",
1193 slice->parent_slice_id, slice->slice_id);
1196 s32_t width = max_name_len * 8;
1197 // need to count depth for width update
1198 slices_tree->resize(slices_tree->x(), slices_tree->y(), width > slices_tree_scroll->w() ? width : slices_tree_scroll->w(), slices_tree->h());
1199 // try to select previous node
1200 node = slices_tree->find(to_voidp(current_slice_id));
1202 slices_tree->select_range(node, node);
1206 Function {x11_ui::fill_select_slice_tree(sfinx_slice_vector_t *slices)} {private return_type void
1210 select_slice_tree->clear();
1211 select_slice_tree->draw_lines(1);
1212 select_slice_tree->alternate_color(FL_LIGHT2);
1213 select_slice_tree->trim_color(FL_LIGHT1);
1214 select_slice_tree->edit_on_reselect(0);
1215 sfinx_slice_t *slice;
1216 Fl_Toggle_Node *node;
1217 u32_t max_name_len = 0;
1218 for (u32_t i = 0; i < slices->len(); i++) {
1219 slice = slices->get(i);
1220 string name = slice->name() + string(" [ ") +
1221 slice->description() + string(" ] ");
1222 // replace \\n with spaces
1223 string filt_elems( "\\n");
1224 string::size_type pos = 0;
1225 while (( pos = name.find_first_of(filt_elems, pos)) != string::npos)
1226 name.replace(pos, 1, string(" "));
1227 if (name.size() > max_name_len)
1228 max_name_len = name.size();
1229 if (!slice->parent_slice_id) {
1230 node = select_slice_tree->add_sub((char *)name.c_str());
1231 node->user_data(to_voidp(slice->slice_id));
1233 node = select_slice_tree->find(to_voidp(slice->parent_slice_id));
1235 select_slice_tree->open(node);
1236 node = select_slice_tree->add_sub((char *)name.c_str());
1237 node->user_data(to_voidp(slice->slice_id));
1238 } // else node is not connected - just ignore
1241 s32_t width = max_name_len * 8;
1242 // need to count depth for width update
1243 select_slice_tree->resize(select_slice_tree->x(), select_slice_tree->y(),
1244 width > select_slice_tree_scroll->w() ? width : select_slice_tree_scroll->w(), select_slice_tree->h());
1248 Function {x11_ui::edit_slice(sfinx_slice_t *slice)} {private return_type void
1252 slice_name_i->value(slice->name());
1253 slice_directory_i->value(slice->directory());
1254 slice_name_i->take_focus();
1255 slice_description_i->value(slice->description());
1256 string status_line = "Parent slice: ";
1257 status_line += slice->parent_name();
1258 int cyear, cmonth, cday, eyear, emonth, eday, chour, cmin, csec, ehour, emin, esec;
1259 slice->ctime.GetDate(cyear, cmonth, cday);
1260 slice->etime.GetDate(eyear, emonth, eday);
1261 slice->ctime.GetTime(chour, cmin, csec);
1262 slice->etime.GetTime(ehour, emin, esec);
1264 sprintf(buf, " | Created at %02d/%02d/%02d %02d:%02d:%02d, Modified at %02d/%02d/%02d %02d:%02d:%02d", cyear, cmonth, cday, chour, cmin,
1265 csec, eyear, emonth, eday, ehour, emin, esec);
1267 edit_slice_to->value(status_line.c_str());
1268 edit_slice_w->show();
1272 Function {x11_ui::fill_preferences()} {private return_type void
1276 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, t);
1277 config_files_module_unsorted_path_i->value(t.c_str());
1278 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, t);
1279 config_files_module_sorted_path_i->value(t.c_str());
1280 app->files_module_conf.get(FILES_MODULE_DESC_FILE_NAME, t);
1281 config_files_module_desc_file_name_i->value(t.c_str());
1282 u32_t gen_desc_files;
1283 app->files_module_conf.get(FILES_MODULE_DESC_FILE_ENABLE, &gen_desc_files);
1284 gen_desc_files_b->value(gen_desc_files);
1288 Function {x11_ui::fill_files_module_tree(sfinx_files_vector_t *tree_)} {private return_type void
1291 static sfinx_files_vector_t tree;
1293 files_module_tree_br->user_data((void *)&tree);
1294 files_module_tree_br->clear();
1296 u32_t files = 0, dirs = 0;
1297 // set parent dir id
1298 if (tree.files.size())
1299 current_files_module_tree_path.main_slice_id = tree.files[0]->compressed_fsize;
1300 for (u32_t i = 0; i < tree.files.size(); i++) {
1301 if (tree.files[i]->is_directory)
1302 strcpy(buf, "\\t@b@.");
1305 strncat(buf, tree.files[i]->name.c_str(), 50);
1307 if (tree.files[i]->is_directory) {
1308 strcpy(dir_len, "\\t@b@.< DIR >\\t");
1311 sprintf(dir_len, "\\t%llu\\t", tree.files[i]->fsize);
1314 strcat(buf, dir_len);
1315 int cyear, cmonth, cday, chour, cmin, csec;
1316 tree.files[i]->ctime.GetDate(cyear, cmonth, cday);
1317 tree.files[i]->ctime.GetTime(chour, cmin, csec);
1318 sprintf(dir_len, "%02d/%02d/%04d %02d:%02d:%02d\\t", cday, cmonth, cyear, chour, cmin, csec);
1319 strcat(buf, dir_len);
1320 strcat(buf, tree.files[i]->mimetype.c_str());
1321 files_module_tree_br->add(buf);
1323 files_module_tree_br->redraw();
1325 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
1326 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, root);
1328 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, root);
1329 sprintf(buf, "Path: %s | Total %d file%s and %d director%s", (root + current_files_module_tree_path.name.c_str()).c_str(), files, (files == 1) ? "" : "s", dirs,
1330 (dirs == 1) ? "y" : "ies");
1331 files_module_status_to->value(buf);
1332 files_module_status_to->redraw();
1336 Function {x11_ui::files_module_classify_reply(sfinx_string_t *classify_error)} {private return_type void
1339 if (classify_error->size() == 1) {
1340 classify_file_w->hide();
1341 app->sfinx.send(current_files_module_tree_path);
1342 // files_module_tree_br->remove(files_module_tree_br->value());
1344 fl_alert(classify_error->c_str());
1348 Function {x11_ui::progress(sfinx_progress_t *p)} {private return_type void
1351 static char buf[128];
1352 switch (p->status()) {
1353 case SFINX_PROGRESS_START:
1354 progress_l->label(p->label());
1355 strcpy(buf, p->strvalue());
1356 progress_bar->label(buf);
1357 progress_bar->minimum(0);
1358 progress_bar->maximum(p->max());
1359 progress_bar->value(p->value());
1361 progress_w->redraw();
1363 case SFINX_PROGRESS_END:
1366 case SFINX_PROGRESS_NONE:
1373 Function {x11_ui::alert(sfinx_string_t *alert)} {private return_type void
1376 if (alert->size() != 1)
1377 fl_alert(alert->c_str());
1381 Function {x11_ui::files_module_edit(sfinx_file_t *f)} {open private return_type void
1384 static sfinx_file_t file;
1387 int eyear, emonth, eday, ehour, emin, esec, cyear, cmonth, cday, chour, cmin, csec;
1388 file.etime.GetDate(eyear, emonth, eday);
1389 file.etime.GetTime(ehour, emin, esec);
1390 file.ctime.GetDate(cyear, cmonth, cday);
1391 file.ctime.GetTime(chour, cmin, csec);
1392 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,
1393 chour, cmin, csec, eday, emonth, eyear, ehour, emin, esec);
1395 if (current_files_module_tree_path.id() == SFINX_FILES_MODULE_UNSORTED_TREE_REQUEST)
1396 app->files_module_conf.get(FILES_MODULE_UNSORTED_PATH, path);
1398 app->files_module_conf.get(FILES_MODULE_SORTED_TREE_PATH, path);
1399 string t = "URL: " + path + current_files_module_tree_path.name + "/" + file.name + " | " + file.mimetype + " | Size: " + buf;
1400 classify_file_to->value(t.c_str());
1401 file_title_i->value(file.title.c_str());
1402 file_name_i->value(file.name.c_str());
1403 // save orig file name
1404 file.orig_name = file.name;
1405 file.id(SFINX_FILES_MODULE_EDIT_FILE); // edit file
1406 file_title_i->take_focus();
1407 file_authority_i->value(file.authority.c_str());
1408 file_description_i->value(file.description.c_str());
1409 file_comments_i->value(file.comments.c_str());
1410 sorted_location_b->value(file.sorted_location);
1411 file_compress_b->value(file.store_compressed);
1412 file_gen_csum_b->value(file.generate_csum);
1413 static string main_slice_name;
1414 main_slice_name = app->slice_name(file.main_slice_id);
1415 file_main_slice_b->label(main_slice_name.c_str());
1416 file_main_slice_b->user_data(to_voidp(file.main_slice_id)); // ÔÕÔÁ ÈÒÁÎÉÔÓÑ main_slice_id
1417 file_additional_slices_br->clear();
1418 for (u32_t i = 0; i < file.slices.size(); i++)
1419 file_additional_slices_br->add((app->slice_name(file.slices[i]).c_str()), to_voidp(file.slices[i]));
1420 classify_file_w->user_data((void *)&file);
1421 classify_file_w->show();
1425 Function {x11_ui::files_module_edit_reply(sfinx_string_t *classify_error)} {private return_type void
1428 if (classify_error->size() == 1) {
1429 app->sfinx.send(current_files_module_tree_path);
1430 classify_file_w->hide();
1432 fl_alert(classify_error->c_str());
1436 Function {x11_ui::search_browser(sfinx_pair_vector_t *r)} {private return_type void
1439 search_browser_br->clear();
1441 search_browser_br->add("Sfinx has no data for this query");
1444 goto_page_ch->clear();
1445 /*for (u32_t i = 1; i < 50; i++) {
1447 sprintf(b, "%d", i);
1448 goto_page_ch->add(b, 0, 0, (void *)i);
1449 // Fl_Menu_Item *item = (Fl_Menu_Item *)(goto_page_ch->menu() + n);
1450 // item->color(FL_GREEN);
1452 goto_page_ch->value(0);
1453 //goto_page_ch->selection_color(FL_GREEN);
1456 for (u32_t i = 0; i < r->len(); i++) {
1457 sfinx_pair_t *p = r->find(i);
1461 if (!p->get(i, &el))
1465 prepare_search_info(el, inf);
1466 string::size_type pos = 0, found;
1467 while ((found = inf.find('\\n', pos)) != string::npos) {
1468 string line(inf, pos, found - pos);
1469 search_browser_br->add(line.c_str());
1472 search_browser_br->add("@-");
1475 search_browser_w->show();
1479 Function {x11_ui::prepare_search_info(sfinx_t *el, string &inf)} {private return_type void
1481 code {sfinx_file_t *f;
1483 case SFINX_ELEMENT_FILE:
1484 f = (sfinx_file_t *)el;
1485 inf = "\\nType: File\\n";
1486 inf.append("Slice Hierarchy: " + app->slice_hierarchy(f->main_slice_id) + "\\n");
1487 if (f->slices.size()) {
1488 inf.append("Additional Slices : ");
1489 for (u32_t i = 0; i < f->slices.size(); i++) {
1492 inf.append(app->slice_name(f->slices[i]));
1496 inf.append("Title: " + f->title + "\\n");
1497 inf.append("Authority: " + f->authority + "\\n");
1498 inf.append("Description: " + f->description + "\\n");
1499 inf.append("Comments: " + f->comments + "\\n");
1500 inf.append("Name: " + f->name + "\\n");
1502 sprintf(buf, "%llu bytes\\n", f->fsize);
1503 inf.append("Size: ");
1506 inf.append("Csum: " + f->csum + "\\n");
1507 sprintf(buf, "%llu bytes\\n", f->compressed_fsize);
1508 inf.append("Compressed Size: ");
1510 if (f->compressed_csum.size())
1511 inf.append("Compressed Csum: " + f->compressed_csum + "\\n");
1512 int year, month, day, hour, min, sec;
1513 f->ctime.GetDate(year, month, day);
1514 f->ctime.GetTime(hour, min, sec);
1515 sprintf(buf, "Create Entry Time: %02d/%02d/%04d %02d:%02d:%02d\\n", day, month, year, hour, min, sec);
1517 f->etime.GetDate(year, month, day);
1518 f->etime.GetTime(hour, min, sec);
1519 sprintf(buf, "Edit Entry Time: %02d/%02d/%04d %02d:%02d:%02d\\n", day, month, year, hour, min, sec);
1524 debug("Can't fill element info !");