X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2Fxforms_helpers.C;h=67055a5c1a5425e78446ff0ce11ee70d4a986a95;hb=e8c9544a2d74248d6b64d4833f01874893aca2ee;hp=fab98d9d8d704ed4687613ab726da3918fc93d3f;hpb=fe66fc4644fe336a08e2ce4528b0ccec3d3dd0a8;p=lyx.git diff --git a/src/frontends/xforms/xforms_helpers.C b/src/frontends/xforms/xforms_helpers.C index fab98d9d8d..67055a5c1a 100644 --- a/src/frontends/xforms/xforms_helpers.C +++ b/src/frontends/xforms/xforms_helpers.C @@ -10,9 +10,6 @@ #include -#ifdef __GNUG__ -#pragma implementation -#endif #include "xforms_helpers.h" @@ -26,21 +23,46 @@ #include "support/filetools.h" #include "support/lstrings.h" // frontStrip, strip -#include #include -#include #include FORMS_H_LOCATION using std::ofstream; using std::pair; using std::vector; +using std::make_pair; bool isActive(FL_OBJECT * ob) { return ob && ob->active > 0; } +std::pair parse_shortcut(string const & str) +{ + string::size_type i = str.find_first_of("&"); + if (i == string::npos || i == str.length() - 1) + return make_pair(str, string()); + + // FIXME: handle && + + string::value_type c = str[i + 1]; + return make_pair(str.substr(0, i) + str.substr(i + 1), + string("#") + c); +} + + +// A wrapper for the xforms routine, but this one accepts uint args +unsigned long fl_getmcolor(int i, + unsigned int * r, unsigned int * g, unsigned int * b) +{ + int r2, g2, b2; + unsigned long ret_val = ::fl_getmcolor(i, &r2, &g2, &b2); + *r = r2; + *g = g2; + *b = b2; + return ret_val; +} + // Set an FL_OBJECT to activated or deactivated void setEnabled(FL_OBJECT * ob, bool enable) @@ -163,7 +185,7 @@ void updateWidgetsFromLength(FL_OBJECT * input, FL_OBJECT * choice, lyx::Assert(input && input->objclass == FL_INPUT && choice && choice->objclass == FL_CHOICE); - if (len.zero()) { + if (len.empty()) { fl_set_input(input, ""); fl_set_choice_text(choice, default_unit.c_str()); } else { @@ -329,7 +351,7 @@ bool XformsColor::write(string const & filename) << "### file " << filename << "\n\n" << "### This file is written by LyX, if you want to make your own\n" << "### modifications you should do them from inside LyX and save\n" - << "\n"; + << '\n'; for (int i = 0; i < xformCount; ++i) { string const tag = xformTags[i].tag; @@ -338,8 +360,8 @@ bool XformsColor::write(string const & filename) fl_getmcolor(colorID, &color.r, &color.g, &color.b); - os << tag << " " - << color.r << " " << color.g << " " << color.b << "\n"; + os << tag << ' ' + << color.r << ' ' << color.g << ' ' << color.b << '\n'; } return true;