X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyx_gui_misc.C;h=dc3a66d7334b30c1945f1f96611a078d604cf7b9;hb=3df345c9383480f68fad51feae8b9c64425c8729;hp=1084810b02ac6e7e39231a21fc8c2a8e2a67e901;hpb=5f3f9ad231bc0c24d34c00e3936e226d9834589a;p=lyx.git diff --git a/src/lyx_gui_misc.C b/src/lyx_gui_misc.C index 1084810b02..dc3a66d733 100644 --- a/src/lyx_gui_misc.C +++ b/src/lyx_gui_misc.C @@ -5,7 +5,7 @@ * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -32,11 +32,13 @@ #include "insets/insetindex.h" #include "LyXView.h" +using std::pair; +using std::make_pair; + extern BufferView * current_view; extern FD_form_paragraph * fd_form_paragraph; extern FD_form_paragraph_extra * fd_form_paragraph_extra; -extern FD_form_search * fd_form_search; extern FD_form_character * fd_form_character; extern FD_form_document * fd_form_document; extern FD_form_paper * fd_form_paper; @@ -96,9 +98,6 @@ void CloseAllBufferRelatedPopups() if (fd_form_paragraph_extra->form_paragraph_extra->visible) { fl_hide_form(fd_form_paragraph_extra->form_paragraph_extra); } - if (fd_form_search->form_search->visible) { - fl_hide_form(fd_form_search->form_search); - } if (fd_form_character->form_character->visible) { fl_hide_form(fd_form_character->form_character); } @@ -370,11 +369,7 @@ bool AskQuestion(string const & s1, string const & s2, string const & s3) { fl_set_resource("flQuestion.yes.label", idex(_("Yes|Yy#y"))); fl_set_resource("flQuestion.no.label", idex(_("No|Nn#n"))); -#if FL_REVISION > 85 return fl_show_question((s1 + "\n" + s2 + "\n" + s3).c_str(), 0); -#else - return fl_show_question(s1.c_str(), s2.c_str(), s3.c_str()); -#endif } @@ -384,23 +379,15 @@ int AskConfirmation(string const & s1, string const & s2, string const & s3) fl_set_choices_shortcut(scex(_("Yes|Yy#y")), scex(_("No|Nn#n")), scex(_("Cancel|^["))); -#if FL_REVISION < 86 - return fl_show_choice(s1.c_str(), s2.c_str(), s3.c_str(), - 3, idex(_("Yes|Yy#y")), - idex(_("No|Nn#n")), - idex(_("Cancel|^["))); -#endif -#if FL_REVISION > 85 return fl_show_choice(s1.c_str(), s2.c_str(), s3.c_str(), 3, idex(_("Yes|Yy#y")), idex(_("No|Nn#n")), idex(_("Cancel|^[")), 3); -#endif } // Asks for a text -string askForText(string const & msg, string const & dflt) +pair askForText(string const & msg, string const & dflt) { char const * tmp; fl_set_resource("flInput.cancel.label", idex(_("Cancel|^["))); @@ -408,9 +395,9 @@ string askForText(string const & msg, string const & dflt) fl_set_resource("flInput.clear.label", idex(_("Clear|#e"))); tmp = fl_show_input(msg.c_str(), dflt.c_str()); if (tmp != 0) - return tmp; + return make_pair(true, tmp); else - return string(); + return make_pair(false, string()); } @@ -422,3 +409,11 @@ void WarnReadonly(string const & file) _("The document is read-only:"), file); } + +/// Get the dpi setting of the current screen +float getScreenDPI() +{ + Screen * scr = DefaultScreenOfDisplay(fl_get_display()); + return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) + + (WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2; +}