From: Jean-Marc Lasgouttes Date: Fri, 19 Jan 2001 15:31:40 +0000 (+0000) Subject: Small fixes from Lior and Angus X-Git-Tag: 1.6.10~21718 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a410ecbf08a934e5abacda7b233f97a5e9ecc6a9;p=features.git Small fixes from Lior and Angus git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1349 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index c6b8506ac2..5c7472d5ed 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-01-19 Jean-Marc Lasgouttes + + * lyxfunc.C: fix the name of the inset for LFUN_CHILDINSERT + + * text2.C: add a using directive. + 2000-01-17 John Levon * BufferView2.C: diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index fe1d09707a..40b170b988 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,9 @@ +2001-01-18 Angus Leeming + + * FormPrint.[Ch] (browse): new method to browse for file to print to. + + * forms/form_print.fd: give the form a Browse button. + 2001-01-17 Dekel Tsur * FormRef.C (input): Fix the behavior of goto reference button. diff --git a/src/frontends/xforms/FormPrint.C b/src/frontends/xforms/FormPrint.C index 29f5126949..969804a670 100644 --- a/src/frontends/xforms/FormPrint.C +++ b/src/frontends/xforms/FormPrint.C @@ -21,7 +21,8 @@ #include "Liason.h" #include "debug.h" #include "BufferView.h" -#include "lyx_gui_misc.h" // WriteAlert +#include "lyx_gui_misc.h" // WriteAlert +#include "xform_helpers.h" // for browseFile #ifdef SIGC_CXX_NAMESPACES using SigC::slot; @@ -32,6 +33,7 @@ using Liason::printBuffer; using Liason::getPrinterParams; #endif +using std::make_pair; FormPrint::FormPrint(LyXView * lv, Dialogs * d) : FormBaseBD(lv, d, _("Print"), new OkApplyCancelPolicy), @@ -202,7 +204,7 @@ void FormPrint::update() // It would be nice if we checked for cases like: // Print only-odd-pages and from_page == an even number // -bool FormPrint::input(FL_OBJECT *, long) +bool FormPrint::input(FL_OBJECT * ob, long) { bool activate = true; @@ -237,6 +239,10 @@ bool FormPrint::input(FL_OBJECT *, long) activate = false; } + if (ob == dialog_->button_browse) { + browse(); + } + // it is probably legal to have no printer name since the system will // have a default printer set. Or should have. // if (fl_get_button(dialog_->radio_printer) @@ -245,3 +251,25 @@ bool FormPrint::input(FL_OBJECT *, long) // } return activate; } + + +void FormPrint::browse() +{ + // Get the filename from the dialog + string const filename = fl_get_input(dialog_->input_file); + + string const title = N_("Print to file"); + string const pattern = "*.ps"; + + // Show the file browser dialog + string const new_filename = + browseFile(filename, title, pattern, + make_pair(string(), string()), + make_pair(string(), string())); + + // Save the filename to the dialog + if (new_filename != filename && !new_filename.empty()) { + fl_set_input(dialog_->input_file, new_filename.c_str()); + input(0, 0); + } +} diff --git a/src/frontends/xforms/FormPrint.h b/src/frontends/xforms/FormPrint.h index 0f9f69dda1..5357913feb 100644 --- a/src/frontends/xforms/FormPrint.h +++ b/src/frontends/xforms/FormPrint.h @@ -49,6 +49,8 @@ private: virtual FL_FORM * form() const; /// Build the dialog virtual void build(); + /// Open the file browse dialog. + void browse(); /// FD_form_print * build_print(); diff --git a/src/frontends/xforms/form_print.C b/src/frontends/xforms/form_print.C index 7f5060f411..1ae592570e 100644 --- a/src/frontends/xforms/form_print.C +++ b/src/frontends/xforms/form_print.C @@ -22,9 +22,9 @@ FD_form_print * FormPrint::build_print() FL_OBJECT *obj; FD_form_print *fdui = new FD_form_print; - fdui->form = fl_bgn_form(FL_NO_BOX, 340, 360); + fdui->form = fl_bgn_form(FL_NO_BOX, 340, 390); fdui->form->u_vdata = this; - obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 360, ""); + obj = fl_add_box(FL_UP_BOX, 0, 0, 340, 390, ""); fdui->input_printer = obj = fl_add_input(FL_NORMAL_INPUT, 90, 225, 230, 30, ""); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseInputCB, 0); @@ -49,19 +49,19 @@ FD_form_print * FormPrint::build_print() fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_group(); - fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 315, 100, 30, _("OK")); + fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 10, 350, 100, 30, _("OK")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseOKCB, 0); { char const * const dummy = N_("Apply|#A"); - fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 120, 315, 100, 30, idex(_(dummy))); + fdui->button_apply = obj = fl_add_button(FL_NORMAL_BUTTON, 120, 350, 100, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_callback(obj, C_FormBaseApplyCB, 0); { char const * const dummy = N_("Cancel|C#C^["); - fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 315, 100, 30, idex(_(dummy))); + fdui->button_cancel = obj = fl_add_button(FL_NORMAL_BUTTON, 230, 350, 100, 30, idex(_(dummy))); fl_set_button_shortcut(obj, scex(_(dummy)), 1); } fl_set_object_lsize(obj, FL_NORMAL_SIZE); @@ -135,9 +135,16 @@ FD_form_print * FormPrint::build_print() obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 180, 110, 150, 90, _("Copies")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); - obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 210, 320, 100, _("Print to")); + obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 210, 320, 130, _("Print to")); fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lstyle(obj, FL_BOLD_STYLE); + { + char const * const dummy = N_("Browse|#B"); + fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 220, 300, 100, 30, idex(_(dummy))); + fl_set_button_shortcut(obj, scex(_(dummy)), 1); + } + fl_set_object_lsize(obj, FL_NORMAL_SIZE); + fl_set_object_callback(obj, C_FormBaseInputCB, 0); fl_end_form(); fdui->form->fdui = fdui; diff --git a/src/frontends/xforms/form_print.h b/src/frontends/xforms/form_print.h index 5c369d0a1a..eda70ba0d4 100644 --- a/src/frontends/xforms/form_print.h +++ b/src/frontends/xforms/form_print.h @@ -35,6 +35,7 @@ struct FD_form_print { FL_OBJECT *input_count; FL_OBJECT *radio_collated; FL_OBJECT *input_to_page; + FL_OBJECT *button_browse; }; #endif /* FD_form_print_h_ */ diff --git a/src/frontends/xforms/forms/form_print.fd b/src/frontends/xforms/forms/form_print.fd index dc9169031f..8ad25dc308 100644 --- a/src/frontends/xforms/forms/form_print.fd +++ b/src/frontends/xforms/forms/form_print.fd @@ -9,13 +9,13 @@ Unit of measure: FL_COORD_PIXEL =============== FORM =============== Name: form_print Width: 340 -Height: 360 -Number of Objects: 27 +Height: 390 +Number of Objects: 28 -------------------- class: FL_BOX type: UP_BOX -box: 0 0 340 360 +box: 0 0 340 390 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -141,7 +141,7 @@ argument: -------------------- class: FL_BUTTON type: RETURN_BUTTON -box: 10 315 100 30 +box: 10 350 100 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -159,7 +159,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 120 315 100 30 +box: 120 350 100 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -177,7 +177,7 @@ argument: 0 -------------------- class: FL_BUTTON type: NORMAL_BUTTON -box: 230 315 100 30 +box: 230 350 100 30 boxtype: FL_UP_BOX colors: FL_COL1 FL_COL1 alignment: FL_ALIGN_CENTER @@ -483,7 +483,7 @@ argument: -------------------- class: FL_LABELFRAME type: ENGRAVED_FRAME -box: 10 210 320 100 +box: 10 210 320 130 boxtype: FL_NO_BOX colors: FL_BLACK FL_COL1 alignment: FL_ALIGN_TOP_LEFT @@ -498,5 +498,23 @@ name: callback: argument: +-------------------- +class: FL_BUTTON +type: NORMAL_BUTTON +box: 220 300 100 30 +boxtype: FL_UP_BOX +colors: FL_COL1 FL_COL1 +alignment: FL_ALIGN_CENTER +style: FL_NORMAL_STYLE +size: FL_NORMAL_SIZE +lcol: FL_BLACK +label: Browse|#B +shortcut: +resize: FL_RESIZE_ALL +gravity: FL_NoGravity FL_NoGravity +name: button_browse +callback: C_FormBaseInputCB +argument: 0 + ============================== create_the_forms diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 0506c89ceb..d2610ba929 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2001-01-19 Jean-Marc Lasgouttes + + * lyxinset.h: remove trailing comma in enum. + 2001-01-17 John Levon * insettext.C: kill LyXBell. diff --git a/src/insets/lyxinset.h b/src/insets/lyxinset.h index bbe02c7e49..a8b2d2cc73 100644 --- a/src/insets/lyxinset.h +++ b/src/insets/lyxinset.h @@ -107,7 +107,7 @@ public: /// MATHMACRO_CODE, /// - ERROR_CODE, + ERROR_CODE }; /// diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 3f9461e6ec..d9f7e28269 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -2749,7 +2749,7 @@ string const LyXFunc::Dispatch(int ac, case LFUN_CHILDINSERT: { - InsetCommandParams p( "Include", argument ); + InsetCommandParams p( "include", argument ); Inset * inset = new InsetInclude(p, *owner->buffer()); if (owner->view()->insertInset(inset, "Standard", true)) inset->Edit(owner->view(), 0, 0, 0); diff --git a/src/text2.C b/src/text2.C index a52ac6678d..726c4e0c30 100644 --- a/src/text2.C +++ b/src/text2.C @@ -45,7 +45,9 @@ #include "FloatList.h" using std::copy; +using std::find; using std::endl; +using std::find; using std::pair;