X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyx_gui.C;h=9305d9afce1de98e66cf0a6cc5010c3e8ec8d3eb;hb=617cfbe80f7dca3cab8de7b13f076393b465e11a;hp=50dd4321776af9d6b1df4a42845cbc5d5a45b673;hpb=367dd0efacd3021077cbb8414a35328a5c9b740d;p=lyx.git diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 50dd432177..9305d9afce 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -6,7 +6,7 @@ * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include #include @@ -45,29 +45,29 @@ #include "banner.xpm" #endif -FD_form_title *fd_form_title; -FD_form_paragraph *fd_form_paragraph; -FD_form_paragraph_extra *fd_form_paragraph_extra; -FD_form_search *fd_form_search; -FD_form_character *fd_form_character; -FD_form_document *fd_form_document; -FD_form_paper *fd_form_paper; -FD_form_table_options *fd_form_table_options; -FD_form_table_extra *fd_form_table_extra; -FD_form_quotes *fd_form_quotes; -FD_form_preamble *fd_form_preamble; -FD_form_table *fd_form_table; -FD_form_print *fd_form_print; -FD_form_sendto *fd_form_sendto; -FD_form_figure *fd_form_figure; -FD_form_screen *fd_form_screen; -FD_form_toc *fd_form_toc; -FD_form_ref *fd_form_ref; -FD_LaTeXOptions *fd_latex_options; // from latexoptions.h -FD_LaTeXLog *fd_latex_log; // from latexoptions.h -Combox *combo_language; - -extern LyXServer *lyxserver; +FD_form_title * fd_form_title; +FD_form_paragraph * fd_form_paragraph; +FD_form_paragraph_extra * fd_form_paragraph_extra; +FD_form_search * fd_form_search; +FD_form_character * fd_form_character; +FD_form_document * fd_form_document; +FD_form_paper * fd_form_paper; +FD_form_table_options * fd_form_table_options; +FD_form_table_extra * fd_form_table_extra; +FD_form_quotes * fd_form_quotes; +FD_form_preamble * fd_form_preamble; +FD_form_table * fd_form_table; +FD_form_print * fd_form_print; +FD_form_sendto * fd_form_sendto; +FD_form_figure * fd_form_figure; +FD_form_screen * fd_form_screen; +FD_form_toc * fd_form_toc; +FD_form_ref * fd_form_ref; +FD_LaTeXOptions * fd_latex_options; // from latexoptions.h +FD_LaTeXLog * fd_latex_log; // from latexoptions.h +Combox * combo_language; + +extern LyXServer * lyxserver; extern bool finished; // flag, that we are quitting the program extern BufferList bufferlist; @@ -121,13 +121,13 @@ char selection_color[32]; FL_resource res[] = { - {"width", "widthClass", FL_INT, &width, "690"}, - {"height", "heightClass", FL_INT, &height, "510"}, - {"xpos", "xposClass", FL_INT, &xpos, "-1"}, - {"ypos", "yposClass", FL_INT, &ypos, "-1"}, - {"Reverse", "reverseClass", FL_INT, &reverse_video, "0"}, - {"Mono", "monoClass", FL_INT, &mono_video, "0"}, - {"FastSelection", "selectionClass", FL_INT, &fast_selection, "0"}, + {"width", "widthClass", FL_INT, &width, "690", 0}, + {"height", "heightClass", FL_INT, &height, "510", 0}, + {"xpos", "xposClass", FL_INT, &xpos, "-1", 0}, + {"ypos", "yposClass", FL_INT, &ypos, "-1", 0}, + {"Reverse", "reverseClass", FL_INT, &reverse_video, "0", 0}, + {"Mono", "monoClass", FL_INT, &mono_video, "0", 0}, + {"FastSelection", "selectionClass", FL_INT, &fast_selection, "0", 0}, {"MathColor", "colorClass", FL_STRING, math_color, "blue", 31}, {"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 31}, {"FootColor", "colorClass", FL_STRING, foot_color, "red", 31}, @@ -144,11 +144,11 @@ FL_resource res[] = }; -extern "C" int LyX_XErrHandler(Display *display, XErrorEvent *xeev) +extern "C" int LyX_XErrHandler(Display * display, XErrorEvent * xeev) { //#warning Please see if you can trigger this! // emergency save - if (!bufferlist.isEmpty()) + if (!bufferlist.empty()) bufferlist.emergencyWriteAll(); // Get the reason for the crash. @@ -161,8 +161,8 @@ extern "C" int LyX_XErrHandler(Display *display, XErrorEvent *xeev) } -LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI) - :_owner(owner) +LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI) + : _owner(owner) { gui = GUI; if (!gui) @@ -173,7 +173,7 @@ LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI) static const int num_res = sizeof(res)/sizeof(FL_resource); fl_initialize(argc, argv, "LyX", cmdopt, num_res); fl_get_app_resources(res, num_res); - Display *display = fl_get_display(); + Display * display = fl_get_display(); if (!display) { lyxerr << "LyX: unable to access X display, exiting" << endl; exit(1); @@ -186,18 +186,19 @@ LyXGUI::LyXGUI(LyX *owner, int *argc, char *argv[], bool GUI) // Make sure default screen is not larger than monitor if (width == 690 && height == 510) { - Screen * scr=(DefaultScreenOfDisplay(fl_get_display())); - if (HeightOfScreen(scr)-24form_title, CancelCloseBoxCB, 0); fl_addto_form(fd_form_title->form_title); #ifdef TWO_COLOR_ICONS - FL_OBJECT *obj = fl_add_bitmapbutton(FL_NORMAL_BUTTON,0,0,425,290,""); - fl_set_bitmapbutton_data(obj,banner_bw_width, + FL_OBJECT *obj = fl_add_bitmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, ""); + fl_set_bitmapbutton_data(obj, banner_bw_width, banner_bw_height, banner_bw_bits); - fl_set_object_color(obj,FL_WHITE,FL_BLACK); + fl_set_object_color(obj, FL_WHITE, FL_BLACK); #else - FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON,0,0,425,290,""); - fl_set_pixmapbutton_data(obj, (char**)banner); + FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, ""); + fl_set_pixmapbutton_data(obj, const_cast(banner)); #if FL_REVISION > 85 - fl_set_pixmapbutton_focus_outline(obj,3); + fl_set_pixmapbutton_focus_outline(obj, 3); #endif #endif - fl_set_button_shortcut(obj,"^M ^[",1); - fl_set_object_boxtype(obj,FL_NO_BOX); - fl_set_object_callback(obj,TimerCB,0); + fl_set_button_shortcut(obj, "^M ^[", 1); + fl_set_object_boxtype(obj, FL_NO_BOX); + fl_set_object_callback(obj, TimerCB, 0); - obj = fl_add_text(FL_NORMAL_TEXT,248,265,170,16, LYX_VERSION); - fl_set_object_lsize(obj,FL_NORMAL_SIZE); + obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION); + fl_set_object_lsize(obj, FL_NORMAL_SIZE); #ifdef TWO_COLOR_ICONS - fl_set_object_color(obj,FL_WHITE,FL_WHITE); - fl_set_object_lcol(obj,FL_BLACK); + fl_set_object_color(obj, FL_WHITE, FL_WHITE); + fl_set_object_lcol(obj, FL_BLACK); #else -// fl_set_object_color(obj,FL_WHITE, FL_WHITE); -// fl_set_object_lcol(obj,FL_BLACK); +// fl_set_object_color(obj, FL_WHITE, FL_WHITE); +// fl_set_object_lcol(obj, FL_BLACK); fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c); fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b); - fl_set_object_color(obj,FL_FREE_COL2, FL_FREE_COL2); - fl_set_object_lcol(obj,FL_FREE_COL3); + fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2); + fl_set_object_lcol(obj, FL_FREE_COL3); #endif - fl_set_object_lalign(obj,FL_ALIGN_CENTER|FL_ALIGN_INSIDE); - fl_set_object_lstyle(obj,FL_BOLD_STYLE); + fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE); + fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_end_form(); // the paragraph form @@ -422,6 +423,9 @@ void LyXGUI::create_forms() fl_addto_choice(fd_form_character->choice_color, _(" No change %l| No color | Black | White | Red | Green " "| Blue | Cyan | Magenta | Yellow %l| Reset ")); + fl_set_form_minsize(fd_form_character->form_character, + fd_form_character->form_character->w, + fd_form_character->form_character->h); // the document form fd_form_document = create_form_form_document(); @@ -430,36 +434,36 @@ void LyXGUI::create_forms() fl_addto_choice(fd_form_document->choice_spacing, _(" Single | OneHalf | Double | Other ")); - fl_set_counter_bounds(fd_form_document->slider_secnumdepth,-1,5); - fl_set_counter_bounds(fd_form_document->slider_tocdepth,-1,5); - fl_set_counter_step(fd_form_document->slider_secnumdepth,1,1); - fl_set_counter_step(fd_form_document->slider_tocdepth,1,1); + fl_set_counter_bounds(fd_form_document->slider_secnumdepth,-1, 5); + fl_set_counter_bounds(fd_form_document->slider_tocdepth,-1, 5); + fl_set_counter_step(fd_form_document->slider_secnumdepth, 1, 1); + fl_set_counter_step(fd_form_document->slider_tocdepth, 1, 1); fl_set_counter_precision(fd_form_document->slider_secnumdepth, 0); fl_set_counter_precision(fd_form_document->slider_tocdepth, 0); fl_addto_form(fd_form_document->form_document); combo_language = new Combox(FL_COMBOX_DROPLIST); - FL_OBJECT *ob = fd_form_document->choice_language; + FL_OBJECT * ob = fd_form_document->choice_language; combo_language->add(ob->x, ob->y, ob->w, ob->h, 200); - combo_language->shortcut("#G",1); + combo_language->shortcut("#G", 1); fl_end_form(); int n; // declared here because DEC cxx does not like multiple // declarations of variables in for() loops (JMarc) - for (n=0; tex_babel[n][0]; n++) { + for (n = 0; tex_babel[n][0]; ++n) { combo_language->addto(tex_babel[n]); } // not really necessary, but we can do it anyway. fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12"); - for (n=0; tex_fonts[n][0]; n++) { - fl_addto_choice(fd_form_document->choice_fonts,tex_fonts[n]); + for (n = 0; tex_fonts[n][0]; ++n) { + fl_addto_choice(fd_form_document->choice_fonts, tex_fonts[n]); } fl_addto_choice(fd_form_document->choice_inputenc, "default|latin1|latin2|latin5" "|koi8-r|koi8-u|cp866|cp1251"); - for (n=0; tex_graphics[n][0]; n++) { + for (n = 0; tex_graphics[n][0]; ++n) { fl_addto_choice(fd_form_document->choice_postscript_driver, tex_graphics[n]); } @@ -470,6 +474,9 @@ void LyXGUI::create_forms() _(" Smallskip | Medskip | Bigskip | Length ")); fl_set_input_return(fd_form_document->input_default_skip, FL_RETURN_ALWAYS); + fl_set_form_minsize(fd_form_document->form_document, + fd_form_document->form_document->w, + fd_form_document->form_document->h); // the paper form fd_form_paper = create_form_form_paper(); @@ -535,8 +542,8 @@ void LyXGUI::create_forms() // the table form fd_form_table = create_form_form_table(); fl_set_form_atclose(fd_form_table->form_table, CancelCloseBoxCB, 0); - fl_set_slider_bounds(fd_form_table->slider_rows,1,50); - fl_set_slider_bounds(fd_form_table->slider_columns,1,50); + fl_set_slider_bounds(fd_form_table->slider_rows, 1, 50); + fl_set_slider_bounds(fd_form_table->slider_columns, 1, 50); fl_set_slider_value(fd_form_table->slider_rows, 5); fl_set_slider_value(fd_form_table->slider_columns, 5); fl_set_slider_precision(fd_form_table->slider_rows, 0); @@ -555,7 +562,7 @@ void LyXGUI::create_forms() // the sendto form fd_form_sendto = create_form_form_sendto(); - fl_set_form_atclose(fd_form_sendto->form_sendto,CancelCloseBoxCB,0); + fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0); // the figure form fd_form_figure = create_form_form_figure(); @@ -592,7 +599,7 @@ void LyXGUI::create_forms() int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE; int title_placement = FL_PLACE_CENTER; // Did we get a valid position? - if (xpos>=0 && ypos>=0) { + if (xpos>= 0 && ypos>= 0) { lyxViews->setPosition(xpos, ypos); // show the title form in the middle of the main form fl_set_form_position(fd_form_title->form_title, @@ -633,7 +640,7 @@ void LyXGUI::runTime() } -void LyXGUI::regBuf(Buffer *b) +void LyXGUI::regBuf(Buffer * b) { - lyxViews->currentView()->setBuffer(b); + lyxViews->view()->buffer(b); }