mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
use bformat() when appropriate
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7221 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
16b7144244
commit
0519b8a2f2
@ -1,3 +1,11 @@
|
||||
|
||||
2003-06-30 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* ColorHandler.C:
|
||||
* FormBase.C:
|
||||
* FormDialogView.C:
|
||||
* FormDocument.C: #ifdef BOOSTFORMAT -> bformat
|
||||
|
||||
2003-06-28 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* combox.h: fix some usage of \param
|
||||
|
@ -17,7 +17,8 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include "support/BoostFormat.h"
|
||||
#include "support/tostr.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@ -29,6 +30,17 @@ using std::endl;
|
||||
|
||||
#include "lyx_forms.h"
|
||||
|
||||
namespace {
|
||||
|
||||
string tostr(XColor const & col)
|
||||
{
|
||||
return bformat("(%1$s,%2$s,%3$s)",
|
||||
::tostr(col.red), ::tostr(col.green), ::tostr(col.blue));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
LyXColorHandler::LyXColorHandler()
|
||||
{
|
||||
display = fl_get_display();
|
||||
@ -83,50 +95,24 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
|
||||
// Look up the RGB values for the color, and an approximate
|
||||
// color that we can hope to get on this display.
|
||||
if (XLookupColor(display, colormap, s.c_str(), &xcol, &ccol) == 0) {
|
||||
#if USE_BOOST_FORMAT
|
||||
lyxerr << boost::format(
|
||||
lyxerr << bformat(
|
||||
_("LyX: Unknown X11 color %1$s for %2$s\n"
|
||||
" Using black instead, sorry!"))
|
||||
% s
|
||||
% lcolor.getGUIName(c)
|
||||
<< endl;
|
||||
#else
|
||||
lyxerr << _("LyX: Unknown X11 color ") << s << _(" for ")
|
||||
<< lcolor.getGUIName(c)
|
||||
<< _("\n Using black instead, sorry!") << endl;
|
||||
#endif
|
||||
" Using black instead, sorry!"),
|
||||
s, lcolor.getGUIName(c)) << endl;
|
||||
unsigned long bla = BlackPixel(display,
|
||||
DefaultScreen(display));
|
||||
val.foreground = bla;
|
||||
// Try the exact RGB values first, then the approximate.
|
||||
} else if (XAllocColor(display, colormap, &xcol) != 0) {
|
||||
if (lyxerr.debugging(Debug::GUI)) {
|
||||
#if USE_BOOST_FORMAT
|
||||
lyxerr << boost::format(
|
||||
_("LyX: X11 color %1$s allocated for %2$s"))
|
||||
% s
|
||||
% lcolor.getGUIName(c)
|
||||
<< endl;
|
||||
#else
|
||||
lyxerr << _("LyX: X11 color ") << s
|
||||
<< _(" allocated for ") << lcolor.getGUIName(c)
|
||||
<< endl;
|
||||
#endif
|
||||
lyxerr << bformat(_("LyX: X11 color %1$s allocated for %2$s"),
|
||||
s, lcolor.getGUIName(c)) << endl;
|
||||
}
|
||||
val.foreground = xcol.pixel;
|
||||
} else if (XAllocColor(display, colormap, &ccol)) {
|
||||
#if USE_BOOST_FORMAT
|
||||
lyxerr << boost::format(
|
||||
_("LyX: Using approximated X11 color %1$s"
|
||||
" allocated for %2$s"))
|
||||
% s
|
||||
% lcolor.getGUIName(c)
|
||||
<< endl;
|
||||
#else
|
||||
lyxerr << _("LyX: Using approximated X11 color ") << s
|
||||
<< _(" allocated for ") << lcolor.getGUIName(c)
|
||||
<< endl;
|
||||
#endif
|
||||
lyxerr << bformat(
|
||||
_("LyX: Using approximated X11 color %1$s allocated for %2$s"),
|
||||
s, lcolor.getGUIName(c)) << endl;
|
||||
val.foreground = xcol.pixel;
|
||||
} else {
|
||||
// Here we are traversing the current colormap to find
|
||||
@ -166,35 +152,15 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_BOOST_FORMAT
|
||||
lyxerr << boost::format(
|
||||
_("LyX: Couldn't allocate '%1$s' for %2$s"
|
||||
" with (r,g,b)=(%3$d,%4$d,%5$d).\n"
|
||||
" Using closest allocated color"
|
||||
" with (r,g,b)=(%6$d,%7$d,%8$d) instead.\n"
|
||||
"Pixel [%9$d] is used."))
|
||||
% s
|
||||
% lcolor.getGUIName(c)
|
||||
% xcol.red % xcol.green % xcol.blue
|
||||
% cmap[closest_pixel].red
|
||||
% cmap[closest_pixel].green
|
||||
% cmap[closest_pixel].blue
|
||||
% closest_pixel
|
||||
<< endl;
|
||||
#else
|
||||
lyxerr << _("LyX: Couldn't allocate '") << s
|
||||
<< _("' for ") << lcolor.getGUIName(c)
|
||||
<< _(" with (r,g,b)=(")
|
||||
<< xcol.red << ',' << xcol.green << ',' << xcol.blue
|
||||
<< _(").\n")
|
||||
<< _(" Using closest allocated color with (r,g,b)=(")
|
||||
<< cmap[closest_pixel].red << ','
|
||||
<< cmap[closest_pixel].green << ','
|
||||
<< cmap[closest_pixel].blue
|
||||
<< _(") instead.\nPixel [")
|
||||
<< closest_pixel << _("] is used.")
|
||||
<< endl;
|
||||
#endif
|
||||
lyxerr << bformat(
|
||||
_("LyX: Couldn't allocate '%1$s' for %2$s with (r,g,b)=%3$s.\n"),
|
||||
s, lcolor.getGUIName(c), tostr(xcol));
|
||||
|
||||
lyxerr << bformat(
|
||||
_(" Using closest allocated color with (r,g,b)=%1$s instead.\n"
|
||||
"Pixel [%2$s] is used."),
|
||||
tostr(cmap[closest_pixel]), tostr(closest_pixel)) << endl;
|
||||
|
||||
val.foreground = cmap[closest_pixel].pixel;
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
#include "xforms_helpers.h" // formatted
|
||||
|
||||
#include "gettext.h" // _()
|
||||
#include "support/BoostFormat.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
|
||||
@ -315,20 +315,12 @@ void FormBase::postMessage(string const & message)
|
||||
lyx::Assert(message_widget_);
|
||||
|
||||
int const width = message_widget_->w - 10;
|
||||
#if USE_BOOST_FORMAT
|
||||
boost::format fmter = warning_posted_ ?
|
||||
boost::format(_("WARNING! %1$s")) :
|
||||
boost::format("%1$s");
|
||||
|
||||
string const str = formatted(STRCONV(boost::io::str(fmter % message)),
|
||||
width, FL_NORMAL_SIZE);
|
||||
#else
|
||||
string const tmp = warning_posted_ ?
|
||||
_("WARNING!") + string(" ") + message :
|
||||
bformat(_("WARNING! %1$s"), message) :
|
||||
message;
|
||||
|
||||
string const str = formatted(tmp, width, FL_NORMAL_SIZE);
|
||||
#endif
|
||||
|
||||
fl_set_object_label(message_widget_, str.c_str());
|
||||
FL_COLOR const label_color = warning_posted_ ? FL_RED : FL_LCOL;
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
#include "gettext.h" // _()
|
||||
#include "lyxrc.h"
|
||||
#include "support/BoostFormat.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/LAssert.h"
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
|
||||
@ -312,25 +312,19 @@ void FormDialogView::clearMessage()
|
||||
}
|
||||
|
||||
|
||||
#warning isnt this the same as in FormBase?
|
||||
void FormDialogView::postMessage(string const & message)
|
||||
{
|
||||
lyx::Assert(message_widget_);
|
||||
|
||||
int const width = message_widget_->w - 10;
|
||||
#if USE_BOOST_FORMAT
|
||||
boost::format fmter = warning_posted_ ?
|
||||
boost::format(_("WARNING! %1$s")) :
|
||||
boost::format("%1$s");
|
||||
|
||||
string const str = formatted(STRCONV(boost::io::str(fmter % message)),
|
||||
width, FL_NORMAL_SIZE);
|
||||
#else
|
||||
|
||||
string const tmp = warning_posted_ ?
|
||||
_("WARNING!") + string(" ") + message :
|
||||
bformat(_("WARNING! %1$s"), message) :
|
||||
message;
|
||||
|
||||
string const str = formatted(tmp, width, FL_NORMAL_SIZE);
|
||||
#endif
|
||||
|
||||
fl_set_object_label(message_widget_, str.c_str());
|
||||
FL_COLOR const label_color = warning_posted_ ? FL_RED : FL_LCOL;
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "support/tostr.h"
|
||||
#include "support/lstrings.h" // contains_functor, getStringFromVector
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
#include "support/BoostFormat.h"
|
||||
|
||||
#include "lyx_xpm.h"
|
||||
#include "lyx_forms.h"
|
||||
@ -139,13 +138,7 @@ void FormDocument::build()
|
||||
if (tit->isTeXClassAvailable()) {
|
||||
fl_addto_combox(obj, tit->description().c_str());
|
||||
} else {
|
||||
string item =
|
||||
#if USE_BOOST_FORMAT
|
||||
STRCONV(boost::io::str(boost::format(_("Unavailable: %1$s"))
|
||||
% tit->description()));
|
||||
#else
|
||||
_("Unavailable: ") + tit->description();
|
||||
#endif
|
||||
string item = bformat(_("Unavailable: %1$s"), tit->description());
|
||||
fl_addto_combox(obj, item.c_str());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user