-
-// Extract shortcut from <ident>|<shortcut> string
-const char* flyx_shortcut_extract(const char*sc)
-{
- // Find '|' in the sc and return the string after that.
- register const char *sd = sc;
- while(sd[0]!=0 && sd[0] != '|') sd++;
-
- if (sd[0]=='|') {
- sd++;
- //lyxerr << sd << endl;
- return sd;
- }
- return "";
-}
-
-// Extract identifier from <ident>|<shortcut> string
-const char* flyx_ident_extract(const char *sc)
-{
- register const char *se = sc;
- while(se[0]!=0 && se[0] != '|') se++;
-
- if (se[0]==0) return sc;
-
- char * sb = new char[se-sc + 1];
- int index = 0;
- register const char *sd = sc;
- while (sd != se) {
- sb[index] = sd[0];
- index++; sd++;
- }
- sb[index]=0;
- return sb;
-}
-
-//
-void WriteAlert(string const & s1, string const & s2, string const & s3)
-{
- if (minibuffer) {
- ProhibitInput();
- minibuffer->Set(s1, s2, s3);
- }
-
- fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
- fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
- if (minibuffer) {
- AllowInput();
- }
-}
-
-
-// Alarms user of something related to files
-void WriteFSAlert(string const & s1, string const & s2)
-{
- WriteAlert (s1, s2, strerror(errno));
-}
-
-
-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
-}
-
-// Returns 1 for yes, 2 for no, 3 for cancel.
-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)
-{
- string tmp;
- fl_set_resource("flInput.cancel.label", idex(_("Cancel|^[")));
- fl_set_resource("flInput.ok.label", idex(_("OK|#O")));
- fl_set_resource("flInput.clear.label", idex(_("Clear|#e")));
- tmp = fl_show_input(msg.c_str(), dflt.c_str());
- return tmp;
-}
-
-// Inform the user that the buffer is read-only, and that changes in the
-// dialog box that is to appear will be ignored.
-void WarnReadonly()
-{
- WriteAlert(_("Any changes will be ignored"),
- _("The document is read-only:"),
- current_view->currentBuffer()->getFileName());
-}
-