mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
remove #includes; cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21588 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dd17ccef77
commit
0ee7c6e283
@ -124,16 +124,16 @@ void LyXVC::registrer()
|
||||
}
|
||||
|
||||
LYXERR(Debug::LYXVC) << "LyXVC: registrer" << endl;
|
||||
pair<bool, docstring> tmp =
|
||||
Alert::askForText(_("LyX VC: Initial description"),
|
||||
_("(no initial description)"));
|
||||
if (!tmp.first || tmp.second.empty()) {
|
||||
// should we insist on checking tmp.second.empty()?
|
||||
docstring response;
|
||||
bool ok = Alert::askForText(response, _("LyX VC: Initial description"),
|
||||
_("(no initial description)"));
|
||||
if (!ok || response.empty()) {
|
||||
// should we insist on checking response.empty()?
|
||||
LYXERR(Debug::LYXVC) << "LyXVC: user cancelled" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
vcs->registrer(to_utf8(tmp.second));
|
||||
vcs->registrer(to_utf8(response));
|
||||
}
|
||||
|
||||
|
||||
@ -141,12 +141,12 @@ void LyXVC::checkIn()
|
||||
{
|
||||
|
||||
LYXERR(Debug::LYXVC) << "LyXVC: checkIn" << endl;
|
||||
pair<bool, docstring> tmp = Alert::askForText(_("LyX VC: Log Message"));
|
||||
if (tmp.first) {
|
||||
if (tmp.second.empty()) {
|
||||
tmp.second = _("(no log message)");
|
||||
}
|
||||
vcs->checkIn(to_utf8(tmp.second));
|
||||
docstring response;
|
||||
bool ok = Alert::askForText(response, _("LyX VC: Log Message"));
|
||||
if (ok) {
|
||||
if (response.empty())
|
||||
response = _("(no log message)");
|
||||
vcs->checkIn(to_utf8(response));
|
||||
} else {
|
||||
LYXERR(Debug::LYXVC) << "LyXVC: user cancelled" << endl;
|
||||
}
|
||||
|
@ -9,12 +9,8 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
// GUI-specific implementations
|
||||
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
@ -28,6 +24,7 @@ void warning_pimpl(docstring const & title, docstring const & warning);
|
||||
void error_pimpl(docstring const & title, docstring const & warning);
|
||||
void information_pimpl(docstring const & title, docstring const & warning);
|
||||
|
||||
std::pair<bool, docstring> const askForText_pimpl(docstring const & msg, docstring const & dflt);
|
||||
bool askForText_pimpl(docstring & response,
|
||||
docstring const & msg, docstring const & dflt);
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -31,34 +31,6 @@
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
Application::Application(int &, char **)
|
||||
: current_view_(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LyXView const * Application::currentView() const
|
||||
{
|
||||
return current_view_;
|
||||
}
|
||||
|
||||
|
||||
LyXView * Application::currentView()
|
||||
{
|
||||
return current_view_;
|
||||
}
|
||||
|
||||
|
||||
void Application::setCurrentView(LyXView & current_view)
|
||||
{
|
||||
current_view_ = ¤t_view;
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
|
||||
|
||||
frontend::FontLoader & theFontLoader()
|
||||
|
@ -144,7 +144,7 @@ class Application
|
||||
{
|
||||
public:
|
||||
///
|
||||
Application(int & argc, char ** argv);
|
||||
Application() : current_view_(0) {}
|
||||
///
|
||||
virtual ~Application() {}
|
||||
|
||||
@ -219,20 +219,17 @@ public:
|
||||
unsigned int iconSizeXY, const std::string & geometryArg) = 0;
|
||||
|
||||
///
|
||||
LyXView const * currentView() const;
|
||||
|
||||
LyXView const * currentView() const { return current_view_; }
|
||||
///
|
||||
LyXView * currentView();
|
||||
|
||||
LyXView * currentView() { return current_view_; }
|
||||
///
|
||||
void setCurrentView(LyXView & current_view);
|
||||
void setCurrentView(LyXView & view) { current_view_ = &view; }
|
||||
|
||||
private:
|
||||
/// This LyXView is the one receiving Clipboard and Selection
|
||||
/// Events
|
||||
/// events
|
||||
LyXView * current_view_;
|
||||
|
||||
}; // Application
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "ButtonPolicy.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
@ -565,5 +566,17 @@ void ButtonPolicy::initNoRepeatedApply()
|
||||
}
|
||||
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, ButtonPolicy::State st)
|
||||
{
|
||||
return os << int(st);
|
||||
}
|
||||
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, ButtonPolicy::SMInput smi)
|
||||
{
|
||||
return os << int(smi);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define BUTTONPOLICY_H
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
@ -280,19 +280,8 @@ private:
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
std::ostream & operator<<(std::ostream & os, ButtonPolicy::State st)
|
||||
{
|
||||
return os << int(st);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
std::ostream & operator<<(std::ostream & os, ButtonPolicy::SMInput smi)
|
||||
{
|
||||
return os << int(smi);
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & os, ButtonPolicy::State st);
|
||||
std::ostream & operator<<(std::ostream & os, ButtonPolicy::SMInput smi);
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef BASE_CLIPBOARD_H
|
||||
#define BASE_CLIPBOARD_H
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef DELEGATES_H
|
||||
#define DELEGATES_H
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#define DIALOGS_H
|
||||
|
||||
#include <boost/signal.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -29,7 +28,7 @@ class LyXView;
|
||||
|
||||
/** Container of all dialogs.
|
||||
*/
|
||||
class Dialogs : boost::noncopyable {
|
||||
class Dialogs {
|
||||
public:
|
||||
///
|
||||
Dialogs(LyXView &);
|
||||
@ -89,7 +88,12 @@ public:
|
||||
void disconnect(std::string const & name);
|
||||
///
|
||||
Inset * getOpenInset(std::string const & name) const;
|
||||
|
||||
private:
|
||||
/// noncopyable
|
||||
Dialogs(Dialogs const &);
|
||||
void operator=(Dialogs const &);
|
||||
|
||||
///
|
||||
void redraw() const;
|
||||
///
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef FONT_METRICS_H
|
||||
#define FONT_METRICS_H
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
/**
|
||||
* A class holding helper functions for determining
|
||||
@ -97,15 +97,10 @@ public:
|
||||
int & descent) const = 0;
|
||||
|
||||
/// return the maximum descent of the font
|
||||
inline int maxHeight() const {
|
||||
return maxAscent() + maxDescent();
|
||||
}
|
||||
inline int maxHeight() const { return maxAscent() + maxDescent(); }
|
||||
|
||||
/// return the descent of the char in the font
|
||||
inline int height(char_type c) const
|
||||
{
|
||||
return ascent(c) + descent(c);
|
||||
}
|
||||
inline int height(char_type c) const { return ascent(c) + descent(c); }
|
||||
|
||||
/// return the inner width of the char in the font
|
||||
inline int center(char_type c) const {
|
||||
|
@ -14,19 +14,12 @@
|
||||
#ifndef BASE_GUI_H
|
||||
#define BASE_GUI_H
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class BufferView;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
class LyXView;
|
||||
class WorkArea;
|
||||
|
||||
|
||||
/**
|
||||
@ -42,18 +35,15 @@ public:
|
||||
///
|
||||
virtual bool unregisterView(int id) = 0;
|
||||
///
|
||||
virtual bool closeAllViews()= 0;
|
||||
virtual bool closeAllViews() = 0;
|
||||
|
||||
///
|
||||
virtual LyXView& view(int id) const = 0;
|
||||
virtual LyXView & view(int id) const = 0;
|
||||
///
|
||||
std::vector<int> const & viewIds()
|
||||
{
|
||||
return view_ids_;
|
||||
}
|
||||
std::vector<int> const & viewIds() { return view_ids_; }
|
||||
|
||||
protected:
|
||||
|
||||
///
|
||||
std::vector<int> view_ids_;
|
||||
};
|
||||
|
||||
|
@ -4,13 +4,9 @@ SUBDIRS = $(FRONTENDS_SUBDIRS) .
|
||||
|
||||
DIST_SUBDIRS = qt4 .
|
||||
|
||||
EXTRA_DIST = pch.h
|
||||
|
||||
BUILT_SOURCES = $(PCH_FILE)
|
||||
|
||||
noinst_LTLIBRARIES = liblyxfrontends.la
|
||||
|
||||
AM_CPPFLAGS += $(PCH_FLAGS) -I$(srcdir)/.. $(BOOST_INCLUDES)
|
||||
AM_CPPFLAGS += -I$(srcdir)/.. $(BOOST_INCLUDES)
|
||||
|
||||
liblyxfrontends_la_SOURCES = \
|
||||
alert.cpp \
|
||||
@ -40,7 +36,7 @@ liblyxfrontends_la_SOURCES = \
|
||||
|
||||
################################# Tests ################################
|
||||
|
||||
EXTRA_DIST += tests/test_biblio
|
||||
EXTRA_DIST = tests/test_biblio
|
||||
|
||||
TESTS = \
|
||||
test_biblio
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "Dimension.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
@ -12,19 +12,17 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include "frontends/FontMetrics.h"
|
||||
|
||||
#include "FontInfo.h"
|
||||
|
||||
using lyx::docstring;
|
||||
|
||||
using std::max;
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
static int max(int a, int b) { return a > b ? a : b; }
|
||||
|
||||
|
||||
void Painter::button(int x, int y, int w, int h, bool mouseHover)
|
||||
{
|
||||
if (mouseHover)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "ColorCode.h"
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef BASE_SELECTION_H
|
||||
#define BASE_SELECTION_H
|
||||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
|
||||
#include "support/docstring.h"
|
||||
#include "support/strfwd.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
@ -73,4 +73,4 @@ extern frontend::Selection & theSelection();
|
||||
} // namespace lyx
|
||||
|
||||
|
||||
#endif // BASE_SELECTION_H
|
||||
#endif // SELECTION_H
|
||||
|
@ -17,13 +17,10 @@
|
||||
#include "LyX.h" // for lyx::use_gui
|
||||
|
||||
using std::endl;
|
||||
using std::make_pair;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
namespace frontend {
|
||||
|
||||
int Alert::prompt(docstring const & title, docstring const & question,
|
||||
@ -85,19 +82,21 @@ void Alert::information(docstring const & title, docstring const & message)
|
||||
}
|
||||
|
||||
|
||||
pair<bool, docstring> const Alert::askForText(docstring const & msg,
|
||||
docstring const & dflt)
|
||||
bool Alert::askForText(docstring & response, docstring const & msg,
|
||||
docstring const & dflt)
|
||||
{
|
||||
if (!use_gui || lyxerr.debugging()) {
|
||||
lyxerr << "----------------------------------------\n"
|
||||
<< to_utf8(msg) << '\n'
|
||||
<< "Assuming answer is " << to_utf8(dflt) << '\n'
|
||||
<< "----------------------------------------" << endl;
|
||||
if (!use_gui)
|
||||
return make_pair<bool, docstring>(true, dflt);
|
||||
if (!use_gui) {
|
||||
response = dflt;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return askForText_pimpl(msg, dflt);
|
||||
return askForText_pimpl(response, msg, dflt);
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -55,8 +55,8 @@ void error(docstring const & title, docstring const & message);
|
||||
void information(docstring const & title, docstring const & message);
|
||||
|
||||
/// Asks for a text. DO NOT USE !!
|
||||
std::pair<bool, docstring> const
|
||||
askForText(docstring const & msg, docstring const & dflt = docstring());
|
||||
bool askForText(docstring & response, docstring const & msg,
|
||||
docstring const & dflt = docstring());
|
||||
|
||||
} // namespace Alert
|
||||
} // namespace frontend
|
||||
|
@ -1,6 +0,0 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
@ -126,7 +126,7 @@ GuiApplication * guiApp;
|
||||
|
||||
|
||||
GuiApplication::GuiApplication(int & argc, char ** argv)
|
||||
: QApplication(argc, argv), Application(argc, argv)
|
||||
: QApplication(argc, argv), Application()
|
||||
{
|
||||
QCoreApplication::setOrganizationName("The LyX Community");
|
||||
QCoreApplication::setOrganizationDomain("lyx.org");
|
||||
@ -311,21 +311,20 @@ bool GuiApplication::event(QEvent * e)
|
||||
|
||||
bool GuiApplication::notify(QObject * receiver, QEvent * event)
|
||||
{
|
||||
bool return_value = false;
|
||||
try {
|
||||
return_value = QApplication::notify(receiver, event);
|
||||
return QApplication::notify(receiver, event);
|
||||
}
|
||||
catch (support::ExceptionMessage const & e) {
|
||||
catch (support::ExceptionMessage const & e) {
|
||||
if (e.type_ == support::ErrorException) {
|
||||
Alert::error(e.title_, e.details_);
|
||||
LyX::cref().emergencyCleanup();
|
||||
QApplication::exit(1);
|
||||
} else if (e.type_ == support::WarningException) {
|
||||
Alert::warning(e.title_, e.details_);
|
||||
return return_value;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (std::exception const & e) {
|
||||
catch (std::exception const & e) {
|
||||
docstring s = _("LyX has caught an exception, it will now "
|
||||
"attemp to save all unsaved documents and exit."
|
||||
"\n\nException: ");
|
||||
@ -342,7 +341,7 @@ bool GuiApplication::notify(QObject * receiver, QEvent * event)
|
||||
QApplication::exit(1);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -356,8 +355,7 @@ void GuiApplication::syncEvents()
|
||||
}
|
||||
|
||||
|
||||
bool GuiApplication::getRgbColor(ColorCode col,
|
||||
RGBColor & rgbcol)
|
||||
bool GuiApplication::getRgbColor(ColorCode col, RGBColor & rgbcol)
|
||||
{
|
||||
QColor const & qcol = color_cache_.get(col);
|
||||
if (!qcol.isValid()) {
|
||||
|
@ -101,11 +101,12 @@ int GuiFontMetrics::rbearing(char_type c) const
|
||||
if (is_utf16(c)) {
|
||||
QChar sc = ucs4_to_qchar(c);
|
||||
value = width(c) - metrics_.rightBearing(sc);
|
||||
} else
|
||||
// FIXME: QFontMetrics::leftBearingdoes not support the
|
||||
} else {
|
||||
// FIXME: QFontMetrics::leftBearing does not support the
|
||||
// full unicode range. Once it does, we could use:
|
||||
// metrics_.rightBearing(toqstr(docstring(1,c)));
|
||||
value = width(c);
|
||||
}
|
||||
|
||||
rbearing_cache_.insert(c, value);
|
||||
|
||||
@ -272,5 +273,5 @@ int GuiFontMetrics::descent(char_type c) const
|
||||
return value.descent;
|
||||
}
|
||||
|
||||
} // frontend
|
||||
} // lyx
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
@ -13,29 +13,29 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiImplementation.h"
|
||||
|
||||
#include "GuiView.h"
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
template<class T>
|
||||
void updateIds(std::map<int, T*> const & stdmap, std::vector<int> & ids)
|
||||
{
|
||||
ids.clear();
|
||||
typename std::map<int, T*>::const_iterator it;
|
||||
for (it = stdmap.begin(); it != stdmap.end(); ++it)
|
||||
ids.push_back(it->first);
|
||||
}
|
||||
}
|
||||
using std::map;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
|
||||
{
|
||||
ids.clear();
|
||||
map<int, GuiView *>::const_iterator it;
|
||||
for (it = stdmap.begin(); it != stdmap.end(); ++it)
|
||||
ids.push_back(it->first);
|
||||
}
|
||||
|
||||
|
||||
GuiImplementation::GuiImplementation()
|
||||
{
|
||||
view_ids_.clear();
|
||||
@ -48,7 +48,7 @@ int GuiImplementation::createRegisteredView()
|
||||
int id = 0;
|
||||
while (views_.find(id) != views_.end())
|
||||
id++;
|
||||
views_.insert(std::pair<int, GuiView *>(id, new GuiView(id)));
|
||||
views_[id] = new GuiView(id);
|
||||
updateIds(views_, view_ids_);
|
||||
return id;
|
||||
}
|
||||
@ -60,7 +60,7 @@ bool GuiImplementation::unregisterView(int id)
|
||||
BOOST_ASSERT(views_.find(id) != views_.end());
|
||||
BOOST_ASSERT(views_[id]);
|
||||
|
||||
std::map<int, GuiView *>::iterator it;
|
||||
map<int, GuiView *>::iterator it;
|
||||
for (it = views_.begin(); it != views_.end(); ++it) {
|
||||
if (it->first == id) {
|
||||
views_.erase(id);
|
||||
@ -75,17 +75,15 @@ bool GuiImplementation::unregisterView(int id)
|
||||
bool GuiImplementation::closeAllViews()
|
||||
{
|
||||
updateIds(views_, view_ids_);
|
||||
if (views_.empty())
|
||||
{
|
||||
if (views_.empty()) {
|
||||
// quit in CloseEvent will not be triggert
|
||||
qApp->quit();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::map<int, GuiView*> const cmap = views_;
|
||||
std::map<int, GuiView*>::const_iterator it;
|
||||
for (it = cmap.begin(); it != cmap.end(); ++it)
|
||||
{
|
||||
map<int, GuiView*> const cmap = views_;
|
||||
map<int, GuiView*>::const_iterator it;
|
||||
for (it = cmap.begin(); it != cmap.end(); ++it) {
|
||||
// TODO: return false when close event was ignored
|
||||
// e.g. quitWriteAll()->'Cancel'
|
||||
// maybe we need something like 'bool closeView()'
|
||||
@ -99,7 +97,7 @@ bool GuiImplementation::closeAllViews()
|
||||
}
|
||||
|
||||
|
||||
LyXView& GuiImplementation::view(int id) const
|
||||
LyXView & GuiImplementation::view(int id) const
|
||||
{
|
||||
BOOST_ASSERT(views_.find(id) != views_.end());
|
||||
return *views_.find(id)->second;
|
||||
|
@ -13,23 +13,26 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "GuiSelection.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "qt_helpers.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QString>
|
||||
|
||||
#include "support/lstrings.h"
|
||||
using lyx::support::internalLineEnding;
|
||||
using lyx::support::externalLineEnding;
|
||||
|
||||
using std::endl;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
using support::internalLineEnding;
|
||||
using support::externalLineEnding;
|
||||
|
||||
|
||||
GuiSelection::GuiSelection()
|
||||
: selection_supported_(qApp->clipboard()->supportsSelection())
|
||||
{
|
||||
|
@ -11,8 +11,8 @@
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
#ifndef GUISELECTION_H
|
||||
#define GUISELECTION_H
|
||||
|
||||
#include "frontends/Selection.h"
|
||||
|
||||
@ -51,4 +51,4 @@ private:
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // SELECTION_H
|
||||
#endif // GUISELECTION_H
|
||||
|
@ -29,14 +29,11 @@
|
||||
#include <QDialog>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using std::pair;
|
||||
using std::make_pair;
|
||||
using lyx::support::bformat;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using support::bformat;
|
||||
|
||||
static docstring const formatted(docstring const & text)
|
||||
{
|
||||
const int w = 80;
|
||||
@ -45,13 +42,13 @@ static docstring const formatted(docstring const & text)
|
||||
if (text.empty())
|
||||
return sout;
|
||||
|
||||
docstring::size_type curpos = 0;
|
||||
size_t curpos = 0;
|
||||
docstring line;
|
||||
|
||||
for (;;) {
|
||||
docstring::size_type const nxtpos1 = text.find(' ', curpos);
|
||||
docstring::size_type const nxtpos2 = text.find('\n', curpos);
|
||||
docstring::size_type const nxtpos = std::min(nxtpos1, nxtpos2);
|
||||
while (true) {
|
||||
size_t const nxtpos1 = text.find(' ', curpos);
|
||||
size_t const nxtpos2 = text.find('\n', curpos);
|
||||
size_t const nxtpos = std::min(nxtpos1, nxtpos2);
|
||||
|
||||
docstring const word =
|
||||
nxtpos == docstring::npos ?
|
||||
@ -172,8 +169,8 @@ void information_pimpl(docstring const & tit, docstring const & message)
|
||||
}
|
||||
|
||||
|
||||
pair<bool, docstring> const
|
||||
askForText_pimpl(docstring const & msg, docstring const & dflt)
|
||||
bool askForText_pimpl(docstring & response, docstring const & msg,
|
||||
docstring const & dflt)
|
||||
{
|
||||
docstring const title = bformat(_("LyX: %1$s"), msg);
|
||||
|
||||
@ -184,10 +181,12 @@ askForText_pimpl(docstring const & msg, docstring const & dflt)
|
||||
QLineEdit::Normal,
|
||||
toqstr(dflt), &ok);
|
||||
|
||||
if (ok && !text.isEmpty())
|
||||
return make_pair<bool, docstring>(true, qstring_to_ucs4(text));
|
||||
else
|
||||
return make_pair<bool, docstring>(false, docstring());
|
||||
if (ok && !text.isEmpty()) {
|
||||
response = qstring_to_ucs4(text);
|
||||
return true;
|
||||
}
|
||||
response.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user