mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Angus patch, + allow to set cursor color + constify more local variables
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1226 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1312eeaba5
commit
360cdc0b9f
53
ChangeLog
53
ChangeLog
@ -1,3 +1,56 @@
|
||||
2000-11-17 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/LColor.C (c-tor): fixed a couple of items in the ColorEntry
|
||||
array.
|
||||
* src/LyXAction.C (init): LFUN_SET_COLOR now has the attrib
|
||||
ReadOnly|NoBuffer.
|
||||
|
||||
* src/frontends/xforms/Color.C: (HSVColor c-tor): another bug fix.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.C: re-formatted so that I can
|
||||
see what Lars has changed and what is just white space!
|
||||
Now used X directly to ascertain the RGB color associated with the
|
||||
color name.
|
||||
Replaced the RGB sliders with HSV equivalent. Should be more intuitive
|
||||
to use.
|
||||
Added some sort capability.
|
||||
The X11 color name database input is only displayed if the database
|
||||
isn't found in the standard place.
|
||||
Got rid of struct compare_converter; it wasn't used.
|
||||
Probably some other stuff that I've forgotten.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.h: changed the names of some
|
||||
methods in the Colors struct. Added a couple of structs to help sort
|
||||
colors by name and by RGBColor.
|
||||
|
||||
* src/frontends/xforms/xform_helpers.[Ch]: moved the ReadableDir etc
|
||||
functions into a new class RWInfo.
|
||||
|
||||
* src/frontends/xforms/forms/form_citation.fd: Added some shortcuts.
|
||||
The dialog is now almost navigable using the keyboard. Unfortunately,
|
||||
the cursor has to be inside a browser for it to be activated. There is
|
||||
no visual feedback for the key shortcuts to the arrow keys (use
|
||||
Alt-appropriate arrow key, Alt-x).
|
||||
|
||||
* src/frontends/xforms/forms/form_preferences.fd: hacked the Colors tab
|
||||
around a lot.
|
||||
|
||||
* src/support/filetools.[Ch]: moved out ReadableFile etc and into
|
||||
xform_helpers.[Ch]. See above.
|
||||
|
||||
2000-11-17 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* config/lyxinclude.m4 (LYX_PROG_CXX): please somebody
|
||||
|
||||
* src/screen.C (setCursorColor): new method. Sets the color of the
|
||||
cursor.
|
||||
(ShowManualCursor): call it.
|
||||
Constify some local variables.
|
||||
|
||||
* src/LColor.[Ch] (LColor): add entry for cursor
|
||||
* lib/configure(.m4) (word_to_latex_command): add quotes, removes
|
||||
a warning.
|
||||
|
||||
2000-11-19 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insettabular.C (draw): fixed text border redraw problem.
|
||||
|
@ -203,11 +203,11 @@ dnl Check the version of g++
|
||||
esac
|
||||
if test $lyx_devel_version = yes ; then
|
||||
case $gxx_version in
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -Wconversion -Winline";;
|
||||
2.96*) CXXFLAGS="$CXXFLAGS -Wconversion -Winline";;
|
||||
2.95.*) ;;
|
||||
2.96*) ;;
|
||||
2.97*) CXXFLAGS="$CXXFLAGS -Wconversion -Winline";;
|
||||
*2.91*) ;;
|
||||
*) CXXFLAGS="$CXXFLAGS -pedantic";;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
4
lib/configure
vendored
4
lib/configure
vendored
@ -367,8 +367,8 @@ if test -z "$word_to_latex_command" ; then
|
||||
word_to_latex_command=none
|
||||
fi
|
||||
|
||||
test $word_to_latex_command = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
|
||||
test $word_to_latex_command = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
|
||||
test "$word_to_latex_command" = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
|
||||
test "$word_to_latex_command" = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
|
||||
|
||||
echo $ac_n "checking for Image converter""... $ac_c"
|
||||
echo "$ac_t""(convert)"
|
||||
|
@ -197,8 +197,8 @@ SEARCH_PROG([for a HTML -> Latex converter],html_to_latex_command,html2latex)
|
||||
test $html_to_latex_command = "html2latex" && html_to_latex_command="html2latex \$\$i"
|
||||
|
||||
SEARCH_PROG([for a MSWord -> Latex converter],word_to_latex_command,wvCleanLatex word2x)
|
||||
test $word_to_latex_command = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
|
||||
test $word_to_latex_command = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
|
||||
test "$word_to_latex_command" = "wvCleanLatex" && word_to_latex_command="wvCleanLatex \$\$i \$\$o"
|
||||
test "$word_to_latex_command" = "word2x" && word_to_latex_command="word2x -f latex \$\$i"
|
||||
|
||||
SEARCH_PROG([for Image converter],image_command,convert)
|
||||
test $image_command = "convert" && image_command="convert \$\$i \$\$o"
|
||||
|
@ -48,36 +48,37 @@ src/frontends/kde/refdlg.C
|
||||
src/frontends/kde/tocdlg.C
|
||||
src/frontends/kde/urldlg.C
|
||||
src/frontends/xforms/FormBase.h
|
||||
src/frontends/xforms/FormCitation.C
|
||||
src/frontends/xforms/form_citation.C
|
||||
src/frontends/xforms/FormCopyright.C
|
||||
src/frontends/xforms/FormCitation.C
|
||||
src/frontends/xforms/form_copyright.C
|
||||
src/frontends/xforms/FormDocument.C
|
||||
src/frontends/xforms/FormCopyright.C
|
||||
src/frontends/xforms/form_document.C
|
||||
src/frontends/xforms/FormError.C
|
||||
src/frontends/xforms/FormDocument.C
|
||||
src/frontends/xforms/form_error.C
|
||||
src/frontends/xforms/FormGraphics.C
|
||||
src/frontends/xforms/FormError.C
|
||||
src/frontends/xforms/form_graphics.C
|
||||
src/frontends/xforms/FormIndex.C
|
||||
src/frontends/xforms/FormGraphics.C
|
||||
src/frontends/xforms/form_index.C
|
||||
src/frontends/xforms/FormIndex.C
|
||||
src/frontends/xforms/FormInset.h
|
||||
src/frontends/xforms/FormParagraph.C
|
||||
src/frontends/xforms/form_paragraph.C
|
||||
src/frontends/xforms/FormPreferences.C
|
||||
src/frontends/xforms/FormParagraph.C
|
||||
src/frontends/xforms/form_preferences.C
|
||||
src/frontends/xforms/FormPrint.C
|
||||
src/frontends/xforms/FormPreferences.C
|
||||
src/frontends/xforms/form_print.C
|
||||
src/frontends/xforms/FormRef.C
|
||||
src/frontends/xforms/FormPrint.C
|
||||
src/frontends/xforms/form_ref.C
|
||||
src/frontends/xforms/FormTabular.C
|
||||
src/frontends/xforms/FormRef.C
|
||||
src/frontends/xforms/form_tabular.C
|
||||
src/frontends/xforms/FormTabularCreate.C
|
||||
src/frontends/xforms/FormTabular.C
|
||||
src/frontends/xforms/form_tabular_create.C
|
||||
src/frontends/xforms/FormToc.C
|
||||
src/frontends/xforms/FormTabularCreate.C
|
||||
src/frontends/xforms/form_toc.C
|
||||
src/frontends/xforms/FormUrl.C
|
||||
src/frontends/xforms/FormToc.C
|
||||
src/frontends/xforms/form_url.C
|
||||
src/frontends/xforms/FormUrl.C
|
||||
src/frontends/xforms/Menubar_pimpl.C
|
||||
src/frontends/xforms/xform_helpers.C
|
||||
src/gettext.h
|
||||
src/importer.C
|
||||
src/insets/figinset.C
|
||||
|
@ -58,6 +58,7 @@ LColor::LColor()
|
||||
{ cyan, N_("cyan"), "cyan", "cyan", "cyan" },
|
||||
{ magenta, N_("magenta"), "magenta", "magenta", "magenta" },
|
||||
{ yellow, N_("yellow"), "yellow", "yellow", "yellow" },
|
||||
{ cursor, N_("cursor"), "cursor", "black", "cursor" },
|
||||
{ background, N_("background"), "background", "linen", "background" },
|
||||
{ foreground, N_("foreground"), "foreground", "black", "foreground" },
|
||||
{ selection, N_("selection"), "selection", "LightBlue", "selection" },
|
||||
@ -70,9 +71,9 @@ LColor::LColor()
|
||||
{ language, N_("language"), "language", "Blue", "language" },
|
||||
{ command, N_("command-inset"), "command", "black", "command" },
|
||||
{ commandbg, N_("command-inset background"), "commandbg", "grey80", "commandbg" },
|
||||
{ commandframe, N_("inset frame"), "commandframe", "black", "commandframe" },
|
||||
{ commandframe, N_("command-inset frame"), "commandframe", "black", "commandframe" },
|
||||
{ accent, N_("accent"), "accent", "black", "accent" },
|
||||
{ accentbg, N_("accent background"), "accentbg", "offwhite", "accentbg" },
|
||||
{ accentbg, N_("accent background"), "accentbg", "linen", "accentbg" },
|
||||
{ accentframe, N_("accent frame"), "accentframe", "linen", "accentframe" },
|
||||
{ minipageline, N_("minipage line"), "minipageline", "violet", "minipageline" },
|
||||
{ special, N_("special char"), "special", "RoyalBlue", "special" },
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
|
||||
// Needed interface colors
|
||||
|
||||
/// Cursor color
|
||||
cursor,
|
||||
/// Background color
|
||||
background,
|
||||
/// Foreground color
|
||||
|
@ -379,7 +379,7 @@ void LyXAction::init()
|
||||
{ LFUN_GOTOFILEROW, "server-goto-file-row", "", Noop },
|
||||
{ LFUN_NOTIFY, "server-notify", "", ReadOnly },
|
||||
{ LFUN_SETXY, "server-set-xy", "", ReadOnly },
|
||||
{ LFUN_SET_COLOR, "set-color", "", Noop },
|
||||
{ LFUN_SET_COLOR, "set-color", "", ReadOnly|NoBuffer },
|
||||
{ LFUN_SPELLCHECK, "spellchecker", "", Noop },
|
||||
{ LFUN_SHIFT_TAB, "tab-backward", "", Noop },
|
||||
{ LFUN_TAB, "tab-forward", "", Noop },
|
||||
@ -453,7 +453,7 @@ LyXAction::LyXAction()
|
||||
// if it doesn't exist.
|
||||
int LyXAction::searchActionArg(kb_action action, string const & arg) const
|
||||
{
|
||||
// we really want to use const_iterator (Lgb)
|
||||
// BUG we really want to use const_iterator (Lgb)
|
||||
arg_map::iterator pit = lyx_arg_map.find(action);
|
||||
|
||||
if (pit == lyx_arg_map.end()) {
|
||||
@ -464,7 +464,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
|
||||
return LFUN_UNKNOWN_ACTION;
|
||||
}
|
||||
|
||||
// we really want to use const_iterator (Lgb)
|
||||
// BUG we really want to use const_iterator (Lgb)
|
||||
arg_item::iterator aci = (*pit).second.find(arg);
|
||||
|
||||
if (aci == (*pit).second.end()) {
|
||||
@ -488,7 +488,7 @@ int LyXAction::searchActionArg(kb_action action, string const & arg) const
|
||||
// Returns a pseudo-action given an action and its argument.
|
||||
int LyXAction::getPseudoAction(kb_action action, string const & arg) const
|
||||
{
|
||||
int psdaction = searchActionArg(action, arg);
|
||||
int const psdaction = searchActionArg(action, arg);
|
||||
|
||||
if (isPseudoAction(psdaction)) return psdaction;
|
||||
|
||||
@ -521,7 +521,7 @@ kb_action LyXAction::retrieveActionArg(int pseudo, string & arg) const
|
||||
{
|
||||
arg.erase(); // clear it to be sure.
|
||||
|
||||
// we really want to use const_iterator (Lgb)
|
||||
// BUG we really want to use const_iterator (Lgb)
|
||||
pseudo_map::iterator pit = lyx_pseudo_map.find(pseudo);
|
||||
|
||||
if (pit != lyx_pseudo_map.end()) {
|
||||
@ -544,7 +544,7 @@ int LyXAction::LookupFunc(string const & func) const
|
||||
|
||||
// split action and arg
|
||||
string actstr;
|
||||
string argstr = split(func, actstr, ' ');
|
||||
string const argstr = split(func, actstr, ' ');
|
||||
lyxerr[Debug::ACTION] << "Action: " << actstr << '\n';
|
||||
lyxerr[Debug::ACTION] << "Arg : " << argstr << '\n';
|
||||
|
||||
@ -597,7 +597,7 @@ int LyXAction::getApproxFunc(string const & func) const
|
||||
|
||||
string const LyXAction::getApproxFuncName(string const & func) const
|
||||
{
|
||||
int f = getApproxFunc(func);
|
||||
int const f = getApproxFunc(func);
|
||||
// This will return empty string if f isn't an action.
|
||||
return getActionName(f);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ using std::endl;
|
||||
extern LyXAction lyxaction;
|
||||
ToolbarDefaults toolbardefaults;
|
||||
|
||||
|
||||
ToolbarDefaults::ToolbarDefaults()
|
||||
{
|
||||
init();
|
||||
@ -41,6 +42,7 @@ void ToolbarDefaults::add(int action)
|
||||
defaults.push_back(action);
|
||||
}
|
||||
|
||||
|
||||
void ToolbarDefaults::init()
|
||||
{
|
||||
add(LAYOUTS);
|
||||
@ -159,7 +161,7 @@ void ToolbarDefaults::read(LyXLex & lex)
|
||||
|
||||
void ToolbarDefaults::add(string const & func)
|
||||
{
|
||||
int tf = lyxaction.LookupFunc(func);
|
||||
int const tf = lyxaction.LookupFunc(func);
|
||||
|
||||
if (tf == -1) {
|
||||
lyxerr << "Toolbar::add: no LyX command called`"
|
||||
|
@ -72,7 +72,7 @@ WorkArea::WorkArea(BufferView * o, int xpos, int ypos, int width, int height)
|
||||
<< width << 'x' << height << endl;
|
||||
//
|
||||
FL_OBJECT * obj;
|
||||
const int bw = int(std::abs(float(fl_get_border_width())));
|
||||
int const bw = int(std::abs(float(fl_get_border_width())));
|
||||
|
||||
// We really want to get rid of figinset_canvas.
|
||||
::figinset_canvas = figinset_canvas = obj =
|
||||
@ -169,7 +169,7 @@ void WorkArea::resize(int xpos, int ypos, int width, int height)
|
||||
{
|
||||
fl_freeze_all_forms();
|
||||
|
||||
const int bw = int(std::abs(float(fl_get_border_width())));
|
||||
int const bw = int(std::abs(float(fl_get_border_width())));
|
||||
|
||||
// a box
|
||||
fl_set_object_geometry(backgroundbox, xpos, ypos, width - 15, height);
|
||||
|
28
src/buffer.C
28
src/buffer.C
@ -18,6 +18,7 @@
|
||||
#include <iomanip>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cmath>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <utime.h>
|
||||
@ -807,9 +808,14 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
|
||||
int tmpret = lex.FindToken(string_align);
|
||||
if (tmpret == -1) ++tmpret;
|
||||
if (tmpret != LYX_LAYOUT_DEFAULT) { // tmpret != 99 ???
|
||||
#if 0
|
||||
int tmpret2 = 1;
|
||||
for (; tmpret > 0; --tmpret)
|
||||
tmpret2 = tmpret2 * 2;
|
||||
#else
|
||||
int const tmpret2 = pow(2.0, tmpret);
|
||||
#endif
|
||||
lyxerr << "Tmpret2 = " << tmpret2 << endl;
|
||||
par->align = LyXAlignment(tmpret2);
|
||||
}
|
||||
} else if (token == "\\added_space_top") {
|
||||
@ -2495,7 +2501,9 @@ void Buffer::pop_tag(ostream & os, string const & tag,
|
||||
#warning Use a real stack! (Lgb)
|
||||
#endif
|
||||
// Please, Lars, do not remove the global variable. I already
|
||||
// had to reintroduce it twice! (JMarc)
|
||||
// had to reintroduce it twice! (JMarc)
|
||||
// but...but... I'll remove it anyway. (well not quite) (Lgb)
|
||||
#if 0
|
||||
int j;
|
||||
|
||||
// pop all tags till specified one
|
||||
@ -2508,9 +2516,25 @@ void Buffer::pop_tag(ostream & os, string const & tag,
|
||||
// push all tags, but the specified one
|
||||
for (j = j + 1; j <= pos; ++j) {
|
||||
os << "<" << stack[j] << ">";
|
||||
strcpy(stack[j-1], stack[j]);
|
||||
strcpy(stack[j - 1], stack[j]);
|
||||
}
|
||||
--pos;
|
||||
#else
|
||||
// pop all tags till specified one
|
||||
int j = pos;
|
||||
for (int j = pos; (j >= 0) && (strcmp(stack[j], tag.c_str())); --j)
|
||||
os << "</" << stack[j] << ">";
|
||||
|
||||
// closes the tag
|
||||
os << "</" << tag << ">";
|
||||
|
||||
// push all tags, but the specified one
|
||||
for (int i = j + 1; i <= pos; ++i) {
|
||||
os << "<" << stack[i] << ">";
|
||||
strcpy(stack[i - 1], stack[i]);
|
||||
}
|
||||
--pos;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,7 +75,7 @@ void BufferParams::writeFile(ostream & os) const
|
||||
// then the the preamble
|
||||
if (!preamble.empty()) {
|
||||
// remove '\n' from the end of preamble
|
||||
string tmppreamble = strip(preamble, '\n');
|
||||
string const tmppreamble = strip(preamble, '\n');
|
||||
os << "\\begin_preamble\n"
|
||||
<< tmppreamble
|
||||
<< "\n\\end_preamble\n";
|
||||
@ -198,7 +198,7 @@ void BufferParams::readLanguage(LyXLex & lex)
|
||||
{
|
||||
if (!lex.next()) return;
|
||||
|
||||
string tmptok = lex.GetString();
|
||||
string const tmptok = lex.GetString();
|
||||
|
||||
// check if tmptok is part of tex_babel in tex-defs.h
|
||||
language = languages.getLanguage(tmptok);
|
||||
@ -215,23 +215,18 @@ void BufferParams::readLanguage(LyXLex & lex)
|
||||
|
||||
void BufferParams::readGraphicsDriver(LyXLex & lex)
|
||||
{
|
||||
string tmptok;
|
||||
string test;
|
||||
int n = 0;
|
||||
|
||||
|
||||
if (!lex.next()) return;
|
||||
|
||||
tmptok = lex.GetString();
|
||||
string const tmptok = lex.GetString();
|
||||
// check if tmptok is part of tex_graphics in tex_defs.h
|
||||
int n = 0;
|
||||
while (true) {
|
||||
test = tex_graphics[n++];
|
||||
string const test = tex_graphics[n++];
|
||||
|
||||
if (test == tmptok) {
|
||||
graphicsDriver = tmptok;
|
||||
break;
|
||||
}
|
||||
else if (test == "last_item") {
|
||||
} else if (test == "last_item") {
|
||||
lex.printError(
|
||||
"Warning: graphics driver `$$Token' not recognized!\n"
|
||||
" Setting graphics driver to `default'.\n");
|
||||
|
@ -99,7 +99,7 @@ PreferencesPolicy::PreferencesPolicy()
|
||||
|
||||
void PreferencesPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "PreferencesPolicy::input" << endl;
|
||||
//lyxerr << "PreferencesPolicy::input" << endl;
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases.
|
||||
// Note that I didn't put that special case in the helper function
|
||||
// because it doesn't belong there. Some other
|
||||
@ -161,7 +161,7 @@ OkCancelPolicy::OkCancelPolicy()
|
||||
|
||||
void OkCancelPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "OkCancelPolicy::input" << endl;
|
||||
//lyxerr << "OkCancelPolicy::input" << endl;
|
||||
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases
|
||||
if (SMI_CANCEL == input
|
||||
@ -235,7 +235,7 @@ OkCancelReadOnlyPolicy::OkCancelReadOnlyPolicy()
|
||||
|
||||
void OkCancelReadOnlyPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "OkCancelReadOnlyPolicy" << endl;
|
||||
//lyxerr << "OkCancelReadOnlyPolicy::input" << endl;
|
||||
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases
|
||||
if (SMI_CANCEL == input
|
||||
@ -313,7 +313,7 @@ NoRepeatedApplyReadOnlyPolicy::NoRepeatedApplyReadOnlyPolicy()
|
||||
|
||||
void NoRepeatedApplyReadOnlyPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "NoReapeatedApplyReadOnlyPolicy::input" << endl;
|
||||
//lyxerr << "NoReapeatedApplyReadOnlyPolicy::input" << endl;
|
||||
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases
|
||||
if (SMI_CANCEL == input
|
||||
@ -405,7 +405,7 @@ OkApplyCancelReadOnlyPolicy::OkApplyCancelReadOnlyPolicy()
|
||||
|
||||
void OkApplyCancelReadOnlyPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "OkApplyCancelReadOnlyPolicy::input" << endl;
|
||||
//lyxerr << "OkApplyCancelReadOnlyPolicy::input" << endl;
|
||||
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases
|
||||
if (SMI_CANCEL == input
|
||||
@ -471,7 +471,7 @@ OkApplyCancelPolicy::OkApplyCancelPolicy()
|
||||
|
||||
void OkApplyCancelPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "OkApplyCancelPolicy::input" << endl;
|
||||
//lyxerr << "OkApplyCancelPolicy::input" << endl;
|
||||
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases
|
||||
if (SMI_CANCEL == input
|
||||
@ -529,7 +529,7 @@ NoRepeatedApplyPolicy::NoRepeatedApplyPolicy()
|
||||
|
||||
void NoRepeatedApplyPolicy::input(SMInput input)
|
||||
{
|
||||
lyxerr << "NoRepeatedApplyPolicy::input" << endl;
|
||||
//lyxerr << "NoRepeatedApplyPolicy::input" << endl;
|
||||
|
||||
// CANCEL and HIDE always take us to INITIAL for all cases
|
||||
if (SMI_CANCEL == input
|
||||
|
@ -44,6 +44,7 @@ Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Toolbar::~Toolbar()
|
||||
{
|
||||
delete pimpl_;
|
||||
@ -106,7 +107,7 @@ void Toolbar::push(int nth)
|
||||
|
||||
void Toolbar::add(string const & func, bool doclean)
|
||||
{
|
||||
int tf = lyxaction.LookupFunc(func);
|
||||
int const tf = lyxaction.LookupFunc(func);
|
||||
|
||||
if (tf == -1) {
|
||||
lyxerr << "Toolbar::add: no LyX command called`"
|
||||
@ -115,5 +116,3 @@ void Toolbar::add(string const & func, bool doclean)
|
||||
pimpl_->add(tf, doclean);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,13 +94,12 @@ RGBColor::RGBColor(HSVColor const & hsv)
|
||||
|
||||
HSVColor::HSVColor(RGBColor const & rgb)
|
||||
{
|
||||
// r, g, b lie in the range 0-1, not 0-255.
|
||||
double const r = rgb.r / 255.0;
|
||||
double const g = rgb.g / 255.0;
|
||||
double const b = rgb.b / 255.0;
|
||||
|
||||
double const maxval = max( max( r, g ), b );
|
||||
double const minval = max( min( r, g ), b );
|
||||
double const minval = min( min( r, g ), b );
|
||||
|
||||
v = maxval;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,21 +17,19 @@
|
||||
#ifndef FORMPREFERENCES_H
|
||||
#define FORMPREFERENCES_H
|
||||
|
||||
#include <utility> // for pair
|
||||
#include "FormBase.h"
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include <utility> // pair
|
||||
#include "FormBase.h"
|
||||
#include "Color.h" // NamedColor
|
||||
#include "xform_helpers.h" // XformColor
|
||||
|
||||
class Combox;
|
||||
class Command;
|
||||
class Dialogs;
|
||||
class Format;
|
||||
class LyXView;
|
||||
class NamedColor;
|
||||
class RGBColor;
|
||||
class XformColor;
|
||||
struct FD_form_colors;
|
||||
struct FD_form_converters;
|
||||
struct FD_form_formats;
|
||||
@ -162,7 +160,8 @@ private:
|
||||
///
|
||||
bool input(FL_OBJECT const * const);
|
||||
///
|
||||
void update();
|
||||
void update() { LoadBrowserLyX(); }
|
||||
|
||||
/// Flag whether Xforms colors have changed since last file save
|
||||
bool modifiedXformPrefs;
|
||||
|
||||
@ -170,30 +169,40 @@ private:
|
||||
///
|
||||
void AdjustVal( int, int, double ) const;
|
||||
///
|
||||
bool BrowserLyX() const;
|
||||
bool InputBrowserLyX() const;
|
||||
///
|
||||
bool BrowserX11() const;
|
||||
bool InputBrowserX11() const;
|
||||
///
|
||||
bool Database();
|
||||
void InputHSV();
|
||||
///
|
||||
void LoadBrowserLyX();
|
||||
///
|
||||
bool LoadBrowserX11(string const &) const;
|
||||
bool LoadBrowserX11(string const &);
|
||||
///
|
||||
bool LoadDatabase();
|
||||
///
|
||||
bool Modify() const;
|
||||
///
|
||||
bool RGB() const;
|
||||
///
|
||||
int SearchEntry(RGBColor const &) const;
|
||||
///
|
||||
void Sort();
|
||||
///
|
||||
void SortType();
|
||||
|
||||
///
|
||||
FormPreferences & parent_;
|
||||
///
|
||||
FD_form_colors * dialog_;
|
||||
/// A vector of RGB colors and associated name.
|
||||
/// The usual location of the X11 name database.
|
||||
static string const colorFile;
|
||||
/** A vector of RGB colors and associated name.
|
||||
Each RGB color is unique. */
|
||||
static std::vector<NamedColor> colorDB;
|
||||
/// A vector of xform RGB colors and associated name.
|
||||
static std::vector<XformColor> xformColorDB;
|
||||
|
||||
/// A vector of LyX LColor GUI name and associated RGB color.
|
||||
std::vector<NamedColor> lyxColorDB;
|
||||
/// A vector of xform color ID, RGB colors and associated name.
|
||||
std::vector<XformColor> xformColorDB;
|
||||
};
|
||||
///
|
||||
friend class Colors;
|
||||
@ -569,6 +578,25 @@ private:
|
||||
ScreenFonts screen_fonts_;
|
||||
///
|
||||
SpellChecker spellchecker_;
|
||||
|
||||
/** A couple of helper structs to enable colors to be sorted by name
|
||||
and by color */
|
||||
///
|
||||
struct SortColorsByName {
|
||||
///
|
||||
int operator()(NamedColor const & a, NamedColor const & b) const
|
||||
{ return (a.getname() < b.getname()); }
|
||||
};
|
||||
///
|
||||
struct SortColorsByColor {
|
||||
///
|
||||
SortColorsByColor(RGBColor c) : col(c) {}
|
||||
///
|
||||
int operator()(RGBColor const &, RGBColor const &) const;
|
||||
///
|
||||
RGBColor col;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -26,24 +26,30 @@ FD_form_citation * FormCitation::build_citation()
|
||||
fdui->form->u_vdata = this;
|
||||
fdui->box = obj = fl_add_box(FL_UP_BOX, 0, 0, 435, 665, "");
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 30, 180, 300, _("Inset keys"));
|
||||
fdui->citeBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 30, 180, 300, idex(_("Inset keys|#I")));
|
||||
fl_set_button_shortcut(obj, scex(_("Inset keys|#I")), 1);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, CITEBRSR);
|
||||
fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 240, 30, 180, 300, _("Bibliography keys"));
|
||||
fdui->bibBrsr = obj = fl_add_browser(FL_HOLD_BROWSER, 240, 30, 180, 300, idex(_("Bibliography keys|#B")));
|
||||
fl_set_button_shortcut(obj, scex(_("Bibliography keys|#B")), 1);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP_LEFT);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, BIBBRSR);
|
||||
fdui->addBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 30, 30, 30, _("@4->"));
|
||||
fl_set_button_shortcut(obj, _("#&D"), 1);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, ADD);
|
||||
fdui->delBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 65, 30, 30, _("@9+"));
|
||||
fl_set_button_shortcut(obj, _("#X"), 1);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, DELETE);
|
||||
fdui->upBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 100, 30, 30, _("@8->"));
|
||||
fl_set_button_shortcut(obj, _("#&A"), 1);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, UP);
|
||||
fdui->downBtn = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 135, 30, 30, _("@2->"));
|
||||
fl_set_button_shortcut(obj, _("#&B"), 1);
|
||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, DOWN);
|
||||
fdui->infoBrsr = obj = fl_add_browser(FL_NORMAL_BROWSER, 10, 360, 410, 80, _("Info"));
|
||||
@ -53,11 +59,11 @@ FD_form_citation * FormCitation::build_citation()
|
||||
fl_set_button_shortcut(obj, scex(_("Citation style|#s")), 1);
|
||||
fl_set_object_boxtype(obj, FL_DOWN_BOX);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->textBefore = obj = fl_add_input(FL_NORMAL_INPUT, 100, 520, 250, 30, idex(_("Text before|#b")));
|
||||
fl_set_button_shortcut(obj, scex(_("Text before|#b")), 1);
|
||||
fdui->textBefore = obj = fl_add_input(FL_NORMAL_INPUT, 100, 520, 250, 30, idex(_("Text before|#T")));
|
||||
fl_set_button_shortcut(obj, scex(_("Text before|#T")), 1);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 570, 250, 30, idex(_("Text after|#a")));
|
||||
fl_set_button_shortcut(obj, scex(_("Text after|#a")), 1);
|
||||
fdui->textAftr = obj = fl_add_input(FL_NORMAL_INPUT, 100, 570, 250, 30, idex(_("Text after|#e")));
|
||||
fl_set_button_shortcut(obj, scex(_("Text after|#e")), 1);
|
||||
fl_set_object_resize(obj, FL_RESIZE_X);
|
||||
fdui->button_ok = obj = fl_add_button(FL_RETURN_BUTTON, 130, 630, 90, 30, _("OK"));
|
||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||
|
@ -400,50 +400,63 @@ FD_form_colors * FormPreferences::build_colors()
|
||||
fdui->form = fl_bgn_form(FL_NO_BOX, 450, 360);
|
||||
fdui->form->u_vdata = this;
|
||||
obj = fl_add_box(FL_FLAT_BOX, 0, 0, 450, 360, "");
|
||||
fdui->browser_x11 = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 25, 150, 235, idex(_("X11 color names|#X")));
|
||||
fl_set_button_shortcut(obj, scex(_("X11 color names|#X")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 10, 285, 185, 30, idex(_("Name database|#N")));
|
||||
fdui->input_name = obj = fl_add_input(FL_NORMAL_INPUT, 90, 167, 185, 30, idex(_("Name database|#N")));
|
||||
fl_set_button_shortcut(obj, scex(_("Name database|#N")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 200, 285, 90, 30, idex(_("Browse|#B")));
|
||||
fdui->button_browse = obj = fl_add_button(FL_NORMAL_BUTTON, 280, 167, 90, 30, idex(_("Browse|#B")));
|
||||
fl_set_button_shortcut(obj, scex(_("Browse|#B")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->button_color = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 230, 90, 30, "");
|
||||
fdui->text_file_warning = obj = fl_add_text(FL_NORMAL_TEXT, 5, 204, 441, 110, "");
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fdui->browser_x11 = obj = fl_add_browser(FL_HOLD_BROWSER, 10, 25, 150, 290, idex(_("X11 color names|#X")));
|
||||
fl_set_button_shortcut(obj, scex(_("X11 color names|#X")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->button_color = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 250, 90, 30, "");
|
||||
fl_set_object_boxtype(obj, FL_BORDER_BOX);
|
||||
fl_set_object_color(obj, FL_WHITE, FL_COL1);
|
||||
fdui->valslider_red = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 180, 25, 30, 200, idex(_("R|#R")));
|
||||
fl_set_button_shortcut(obj, scex(_("R|#R")), 1);
|
||||
fl_set_object_color(obj, FL_COL1, FL_RED);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_set_slider_size(obj, 0.15);
|
||||
fdui->valslider_green = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 210, 25, 30, 200, idex(_("G|#G")));
|
||||
fl_set_button_shortcut(obj, scex(_("G|#G")), 1);
|
||||
fl_set_object_color(obj, FL_COL1, FL_GREEN);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_set_slider_size(obj, 0.15);
|
||||
fdui->valslider_blue = obj = fl_add_valslider(FL_VERT_FILL_SLIDER, 240, 25, 30, 200, idex(_("B|#B")));
|
||||
fl_set_button_shortcut(obj, scex(_("B|#B")), 1);
|
||||
fl_set_object_color(obj, FL_COL1, FL_BLUE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_set_slider_size(obj, 0.15);
|
||||
fdui->browser_lyx_objs = obj = fl_add_browser(FL_HOLD_BROWSER, 290, 25, 150, 251, idex(_("LyX objects|#L")));
|
||||
fdui->browser_lyx_objs = obj = fl_add_browser(FL_HOLD_BROWSER, 290, 25, 150, 290, idex(_("LyX objects|#L")));
|
||||
fl_set_button_shortcut(obj, scex(_("LyX objects|#L")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_TOP);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->button_modify = obj = fl_add_button(FL_NORMAL_BUTTON, 320, 285, 90, 30, idex(_("Modify|#M")));
|
||||
fdui->button_modify = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 285, 90, 30, idex(_("Modify|#M")));
|
||||
fl_set_button_shortcut(obj, scex(_("Modify|#M")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->button_sort = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 25, 90, 30, idex(_("Sort|#S")));
|
||||
fl_set_button_shortcut(obj, scex(_("Sort|#S")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->slider_saturation = obj = fl_add_slider(FL_HOR_NICE_SLIDER, 180, 161, 90, 30, idex(_("S|#S")));
|
||||
fl_set_button_shortcut(obj, scex(_("S|#S")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_set_slider_size(obj, 0.15);
|
||||
fdui->slider_value = obj = fl_add_slider(FL_HOR_NICE_SLIDER, 180, 194, 90, 30, idex(_("V|#V")));
|
||||
fl_set_button_shortcut(obj, scex(_("V|#V")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_set_slider_size(obj, 0.15);
|
||||
fdui->dial_hue = obj = fl_add_dial(FL_NORMAL_DIAL, 190, 88, 70, 70, idex(_("H|#H")));
|
||||
fl_set_button_shortcut(obj, scex(_("H|#H")), 1);
|
||||
fl_set_object_lalign(obj, FL_ALIGN_CENTER);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fdui->text_1 = obj = fl_add_text(FL_NORMAL_TEXT, 250, 225, 20, 20, _("1"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_RIGHT|FL_ALIGN_INSIDE);
|
||||
fdui->text_0 = obj = fl_add_text(FL_NORMAL_TEXT, 180, 225, 20, 20, _("0"));
|
||||
fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
||||
fdui->button_type_sort = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 180, 56, 90, 30, idex(_("Alphabet|#A")));
|
||||
fl_set_button_shortcut(obj, scex(_("Alphabet|#A")), 1);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
fl_set_object_callback(obj, C_FormBaseInputCB, 0);
|
||||
fl_set_button(obj, 1);
|
||||
fl_end_form();
|
||||
|
||||
fdui->form->fdui = fdui;
|
||||
|
@ -129,15 +129,20 @@ struct FD_form_colors {
|
||||
~FD_form_colors();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *browser_x11;
|
||||
FL_OBJECT *input_name;
|
||||
FL_OBJECT *button_browse;
|
||||
FL_OBJECT *text_file_warning;
|
||||
FL_OBJECT *browser_x11;
|
||||
FL_OBJECT *button_color;
|
||||
FL_OBJECT *valslider_red;
|
||||
FL_OBJECT *valslider_green;
|
||||
FL_OBJECT *valslider_blue;
|
||||
FL_OBJECT *browser_lyx_objs;
|
||||
FL_OBJECT *button_modify;
|
||||
FL_OBJECT *button_sort;
|
||||
FL_OBJECT *slider_saturation;
|
||||
FL_OBJECT *slider_value;
|
||||
FL_OBJECT *dial_hue;
|
||||
FL_OBJECT *text_1;
|
||||
FL_OBJECT *text_0;
|
||||
FL_OBJECT *button_type_sort;
|
||||
};
|
||||
struct FD_form_converters {
|
||||
~FD_form_converters();
|
||||
|
@ -40,7 +40,7 @@ alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Inset keys
|
||||
label: Inset keys|#I
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
@ -58,7 +58,7 @@ alignment: FL_ALIGN_TOP_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Bibliography keys
|
||||
label: Bibliography keys|#B
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
@ -77,7 +77,7 @@ style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @4->
|
||||
shortcut:
|
||||
shortcut: #&D
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: addBtn
|
||||
@ -95,7 +95,7 @@ style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @9+
|
||||
shortcut:
|
||||
shortcut: #X
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: delBtn
|
||||
@ -113,7 +113,7 @@ style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @8->
|
||||
shortcut:
|
||||
shortcut: #&A
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: upBtn
|
||||
@ -131,7 +131,7 @@ style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: @2->
|
||||
shortcut:
|
||||
shortcut: #&B
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: downBtn
|
||||
@ -184,7 +184,7 @@ alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Text before|#b
|
||||
label: Text before|#T
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
@ -202,7 +202,7 @@ alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Text after|#a
|
||||
label: Text after|#e
|
||||
shortcut:
|
||||
resize: FL_RESIZE_X
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
|
@ -1182,7 +1182,7 @@ argument: 0
|
||||
Name: form_colors
|
||||
Width: 450
|
||||
Height: 360
|
||||
Number of Objects: 10
|
||||
Number of Objects: 15
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
@ -1202,28 +1202,10 @@ name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 10 25 150 235
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: X11 color names|#X
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: browser_x11
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: NORMAL_INPUT
|
||||
box: 10 285 185 30
|
||||
box: 90 167 185 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_TOP
|
||||
@ -1241,7 +1223,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 200 285 90 30
|
||||
box: 280 167 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1256,10 +1238,46 @@ name: button_browse
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 5 204 441 110
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: text_file_warning
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 10 25 150 290
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: X11 color names|#X
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: browser_x11
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 180 230 90 30
|
||||
box: 180 250 90 30
|
||||
boxtype: FL_BORDER_BOX
|
||||
colors: FL_WHITE FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1274,67 +1292,10 @@ name: button_color
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_VALSLIDER
|
||||
type: VERT_FILL_SLIDER
|
||||
box: 180 25 30 200
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_RED
|
||||
alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_TINY_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: R|#R
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: valslider_red
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
slsize: 0.15
|
||||
|
||||
--------------------
|
||||
class: FL_VALSLIDER
|
||||
type: VERT_FILL_SLIDER
|
||||
box: 210 25 30 200
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_GREEN
|
||||
alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_TINY_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: G|#G
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: valslider_green
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
slsize: 0.15
|
||||
|
||||
--------------------
|
||||
class: FL_VALSLIDER
|
||||
type: VERT_FILL_SLIDER
|
||||
box: 240 25 30 200
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_BLUE
|
||||
alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_TINY_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: B|#B
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: valslider_blue
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
slsize: 0.15
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 290 25 150 251
|
||||
box: 290 25 150 290
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP
|
||||
@ -1352,7 +1313,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 320 285 90 30
|
||||
box: 180 285 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
@ -1367,6 +1328,135 @@ name: button_modify
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 180 25 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Sort|#S
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_sort
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_SLIDER
|
||||
type: HOR_NICE_SLIDER
|
||||
box: 180 161 90 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: S|#S
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: slider_saturation
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
slsize: 0.15
|
||||
|
||||
--------------------
|
||||
class: FL_SLIDER
|
||||
type: HOR_NICE_SLIDER
|
||||
box: 180 194 90 30
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: V|#V
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: slider_value
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
slsize: 0.15
|
||||
|
||||
--------------------
|
||||
class: FL_DIAL
|
||||
type: NORMAL_DIAL
|
||||
box: 190 88 70 70
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_RIGHT_BCOL
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: H|#H
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: dial_hue
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 250 225 20 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_RIGHT|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: 1
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: text_1
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_TEXT
|
||||
type: NORMAL_TEXT
|
||||
box: 180 225 20 20
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: 0
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: text_0
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_CHECKBUTTON
|
||||
type: PUSH_BUTTON
|
||||
box: 180 56 90 30
|
||||
boxtype: FL_NO_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Alphabet|#A
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_type_sort
|
||||
callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
value: 1
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_converters
|
||||
Width: 450
|
||||
|
@ -168,7 +168,7 @@ bool XformColor::read(string const & filename)
|
||||
|
||||
fl_mapcolor(le, col.r, col.g, col.b);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -205,3 +205,153 @@ bool XformColor::write(string const & filename)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
string RWInfo::error_message;
|
||||
|
||||
bool RWInfo::WriteableDir(string const & name)
|
||||
{
|
||||
error_message.erase();
|
||||
|
||||
if (!AbsolutePath(name)) {
|
||||
error_message = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo const tp(name);
|
||||
if (!tp.isDir()) {
|
||||
error_message = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tp.writable()) {
|
||||
error_message = N_("Cannot write to this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RWInfo::ReadableDir(string const & name)
|
||||
{
|
||||
error_message.erase();
|
||||
|
||||
if (!AbsolutePath(name)) {
|
||||
error_message = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo const tp(name);
|
||||
if (!tp.isDir()) {
|
||||
error_message = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tp.readable()) {
|
||||
error_message = N_("Cannot read this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RWInfo::WriteableFile(string const & name)
|
||||
{
|
||||
// A writeable file is either:
|
||||
// * An existing file to which we have write access, or
|
||||
// * A file that doesn't yet exist but that would exist in a writeable
|
||||
// directory.
|
||||
|
||||
error_message.erase();
|
||||
|
||||
if (name.empty()) {
|
||||
error_message = N_("No file input.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string const dir = OnlyPath(name);
|
||||
if (!AbsolutePath(dir)) {
|
||||
error_message = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo d(name);
|
||||
if (!d.isDir()) {
|
||||
d.newFile(dir);
|
||||
}
|
||||
|
||||
if (!d.isDir()) {
|
||||
error_message = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.writable()) {
|
||||
error_message = N_("Cannot write to this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo f(name);
|
||||
if (dir == name || f.isDir()) {
|
||||
error_message = N_("A file is required, not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (f.exist() && !f.writable()) {
|
||||
error_message = N_("Cannot write to this file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool RWInfo::ReadableFile(string const & name)
|
||||
{
|
||||
error_message.erase();
|
||||
|
||||
if (name.empty()) {
|
||||
error_message = N_("No file input.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string const dir = OnlyPath(name);
|
||||
if (!AbsolutePath(dir)) {
|
||||
error_message = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo d(name);
|
||||
if (!d.isDir()) {
|
||||
d.newFile(dir);
|
||||
}
|
||||
|
||||
if (!d.isDir()) {
|
||||
error_message = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.readable()) {
|
||||
error_message = N_("Cannot read from this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo f(name);
|
||||
if (dir == name || f.isDir()) {
|
||||
error_message = N_("A file is required, not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.exist()) {
|
||||
error_message = N_("File does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.readable()) {
|
||||
error_message = N_("Cannot read from this file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -33,4 +33,24 @@ struct XformColor : public NamedColor {
|
||||
static bool write(string const &);
|
||||
};
|
||||
|
||||
|
||||
/** Some functions that perform some quite detailed tests to ascertain whether
|
||||
the directory or file is readable or writeable. If not, then an error
|
||||
message is placed in error_message. */
|
||||
class RWInfo {
|
||||
public:
|
||||
///
|
||||
static bool WriteableDir(string const & dir);
|
||||
///
|
||||
static bool ReadableDir(string const & dir);
|
||||
///
|
||||
static bool WriteableFile(string const & file);
|
||||
///
|
||||
static bool ReadableFile(string const & file);
|
||||
///
|
||||
static string const & ErrorMessage() { return error_message; }
|
||||
private:
|
||||
///
|
||||
static string error_message;
|
||||
};
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@ GraphicsCache::~GraphicsCache()
|
||||
{
|
||||
// Free the map.
|
||||
//std::foreach(map.begin(), map.end(), ...);
|
||||
#warning This is a bogus reason to not clean up after your self. (Lgb)
|
||||
//#warning This is a bogus reason to not clean up after your self. (Lgb)
|
||||
// TODO: Clean up here (BE)
|
||||
|
||||
// This is not really needed, it will only happen on program close and in
|
||||
|
@ -44,7 +44,7 @@ bool XPM_Renderer::renderImage()
|
||||
Display * display = fl_get_display();
|
||||
|
||||
//(BE 2000-08-05)
|
||||
#warning This might be a dirty thing, but I dont know any other solution.
|
||||
//#warning This might be a dirty thing, but I dont know any other solution.
|
||||
Screen * screen = ScreenOfDisplay(display, fl_screen);
|
||||
|
||||
int status = XpmReadFileToPixmap(
|
||||
|
@ -70,8 +70,8 @@ int InsetButton::width(BufferView * bv, LyXFont const &) const
|
||||
|
||||
int width, ascent, descent;
|
||||
string s = getScreenLabel();
|
||||
if (!bv)
|
||||
int(s.length());
|
||||
//if (!bv)
|
||||
// int(s.length());
|
||||
|
||||
if (Editable()) {
|
||||
bv->painter().buttonText(0, 0, s, font,
|
||||
|
@ -1124,8 +1124,8 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
|
||||
// now search the right column
|
||||
int lx = tabular->GetWidthOfColumn(actcell) -
|
||||
tabular->GetAdditionalWidth(actcell);
|
||||
#warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
|
||||
#if 0
|
||||
#warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
|
||||
for (; !tabular->IsLastCellInRow(actcell) && (lx < x);
|
||||
++actcell,lx += tabular->GetWidthOfColumn(actcell) +
|
||||
tabular->GetAdditionalWidth(actcell - 1));
|
||||
|
14
src/kbmap.C
14
src/kbmap.C
@ -45,7 +45,7 @@ void printKeysym(unsigned int key, unsigned int mod, string & buf)
|
||||
{
|
||||
mod &= ModsMask;
|
||||
|
||||
char * s = XKeysymToString(key);
|
||||
char const * const s = XKeysymToString(key);
|
||||
|
||||
if (mod & ShiftMask) buf += "S-";
|
||||
if (mod & ControlMask) buf += "C-";
|
||||
@ -75,7 +75,7 @@ int kb_keymap::bind(string const & seq, int action)
|
||||
{
|
||||
kb_sequence k;
|
||||
|
||||
int res = k.parse(seq);
|
||||
int const res = k.parse(seq);
|
||||
if (!res) {
|
||||
defkey(&k, action);
|
||||
} else
|
||||
@ -105,14 +105,14 @@ int kb_keymap::lookup(unsigned int key,
|
||||
return -1;
|
||||
}
|
||||
|
||||
unsigned int msk1, msk0;
|
||||
//unsigned int msk1, msk0;
|
||||
//suppress modifier bits we do not handle
|
||||
mod &= ModsMask;
|
||||
|
||||
for (Table::const_iterator cit = table.begin();
|
||||
cit != table.end(); ++cit) {
|
||||
msk1 = (*cit).mod & 0xffff;
|
||||
msk0 = ((*cit).mod >> 16) & 0xffff;
|
||||
unsigned int const msk1 = (*cit).mod & 0xffff;
|
||||
unsigned int const msk0 = ((*cit).mod >> 16) & 0xffff;
|
||||
if ((*cit).code == key && (mod & ~msk0) == msk1) {
|
||||
// math found:
|
||||
if ((*cit).table) {
|
||||
@ -166,10 +166,10 @@ void kb_keymap::print(string & buf) const
|
||||
|
||||
int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
|
||||
{
|
||||
unsigned int code = seq->sequence[idx];
|
||||
unsigned int const code = seq->sequence[idx];
|
||||
if (code == NoSymbol) return -1;
|
||||
|
||||
unsigned int modmsk = seq->modifiers[idx];
|
||||
unsigned int const modmsk = seq->modifiers[idx];
|
||||
|
||||
// --- check if key is already there --------------------------------
|
||||
if (table.size() != 0) { // without this I get strange crashes
|
||||
|
@ -252,7 +252,7 @@ unsigned int kb_sequence::getsym() const
|
||||
|
||||
char kb_sequence::getiso() const
|
||||
{
|
||||
int c = getsym();
|
||||
int const c = getsym();
|
||||
|
||||
if (c > 0xff)
|
||||
return '\0';
|
||||
|
@ -16,6 +16,12 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
//#define HAVE_ROPE 1
|
||||
|
||||
#ifdef HAVE_ROPE
|
||||
#include <rope>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
@ -122,7 +128,11 @@ public:
|
||||
///
|
||||
typedef char value_type;
|
||||
///
|
||||
#ifndef HAVE_ROPE
|
||||
typedef std::vector<value_type> TextContainer;
|
||||
#else
|
||||
typedef std::rope<value_type> TextContainer;
|
||||
#endif
|
||||
///
|
||||
/* This should be TextContainer::size_type, but we need
|
||||
signed values for now.
|
||||
@ -231,7 +241,9 @@ public:
|
||||
size_type size() const { return text.size(); }
|
||||
///
|
||||
void fitToSize() {
|
||||
#ifndef HAVE_ROPE
|
||||
text.resize(text.size());
|
||||
#endif
|
||||
}
|
||||
///
|
||||
void setContentsFromPar(LyXParagraph * par) {
|
||||
@ -239,7 +251,11 @@ public:
|
||||
}
|
||||
///
|
||||
void clearContents() {
|
||||
#ifndef HAVE_ROPE
|
||||
text.clear();
|
||||
#else
|
||||
text.erase(text.mutable_begin(), text.mutable_end());
|
||||
#endif
|
||||
}
|
||||
|
||||
///
|
||||
@ -427,7 +443,11 @@ public:
|
||||
value_type GetChar(size_type pos) const;
|
||||
/// The position must already exist.
|
||||
void SetChar(size_type pos, value_type c) {
|
||||
#ifndef HAVE_ROPE
|
||||
text[pos] = c;
|
||||
#else
|
||||
text.replace(pos, c);
|
||||
#endif
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -49,6 +49,9 @@ public:
|
||||
///
|
||||
LyXScreen(WorkArea &);
|
||||
|
||||
/// Sets the cursor color to LColor::cursor.
|
||||
void setCursorColor();
|
||||
|
||||
/** Draws the screen form textposition y. Uses as much of
|
||||
the already printed pixmap as possible */
|
||||
void Draw(LyXText *, unsigned int y);
|
||||
|
@ -68,8 +68,9 @@ unsigned int LyXParagraph::paragraph_id = 0;
|
||||
|
||||
LyXParagraph::LyXParagraph()
|
||||
{
|
||||
#ifndef HAVE_ROPE
|
||||
text.reserve(500); // is this number too big?
|
||||
|
||||
#endif
|
||||
for (int i = 0; i < 10; ++i) setCounter(i , 0);
|
||||
appendix = false;
|
||||
enumdepth = 0;
|
||||
@ -92,9 +93,11 @@ LyXParagraph::LyXParagraph()
|
||||
// This konstruktor inserts the new paragraph in a list.
|
||||
LyXParagraph::LyXParagraph(LyXParagraph * par)
|
||||
{
|
||||
#ifndef HAVE_ROPE
|
||||
text.reserve(500);
|
||||
par->text.resize(par->text.size());
|
||||
|
||||
#endif
|
||||
par->fitToSize();
|
||||
|
||||
for (int i = 0; i < 10; ++i) setCounter(i, 0);
|
||||
appendix = false;
|
||||
enumdepth = 0;
|
||||
@ -261,7 +264,7 @@ void LyXParagraph::writeFile(Buffer const * buf, ostream & os,
|
||||
font1 = font2;
|
||||
}
|
||||
|
||||
value_type c = GetChar(i);
|
||||
value_type const c = GetChar(i);
|
||||
switch (c) {
|
||||
case META_INSET:
|
||||
{
|
||||
@ -555,8 +558,11 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
||||
insetlist.erase(it);
|
||||
}
|
||||
}
|
||||
#ifndef HAVE_ROPE
|
||||
text.erase(text.begin() + pos);
|
||||
|
||||
#else
|
||||
text.erase(text.mutable_begin() + pos);
|
||||
#endif
|
||||
// Erase entries in the tables.
|
||||
FontTable search_font(pos, LyXFont());
|
||||
|
||||
@ -566,18 +572,18 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
||||
search_font, matchFT());
|
||||
if (it != fontlist.end() && (*it).pos == pos &&
|
||||
(pos == 0 ||
|
||||
(it != fontlist.begin() && (*(it-1)).pos == pos - 1))) {
|
||||
(it != fontlist.begin() && (*(it - 1)).pos == pos - 1))) {
|
||||
// If it is a multi-character font
|
||||
// entry, we just make it smaller
|
||||
// (see update below), otherwise we
|
||||
// should delete it.
|
||||
unsigned int i = it - fontlist.begin();
|
||||
unsigned int const i = it - fontlist.begin();
|
||||
fontlist.erase(fontlist.begin() + i);
|
||||
it = fontlist.begin() + i;
|
||||
if (i > 0 && i < fontlist.size() &&
|
||||
fontlist[i-1].font == fontlist[i].font) {
|
||||
fontlist.erase(fontlist.begin() + i-1);
|
||||
it = fontlist.begin() + i-1;
|
||||
fontlist[i - 1].font == fontlist[i].font) {
|
||||
fontlist.erase(fontlist.begin() + i - 1);
|
||||
it = fontlist.begin() + i - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -607,7 +613,7 @@ void LyXParagraph::Erase(LyXParagraph::size_type pos)
|
||||
void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
|
||||
LyXParagraph::value_type c)
|
||||
{
|
||||
LyXFont f(LyXFont::ALL_INHERIT);
|
||||
LyXFont const f(LyXFont::ALL_INHERIT);
|
||||
InsertChar(pos, c, f);
|
||||
}
|
||||
|
||||
@ -632,7 +638,11 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
|
||||
#else
|
||||
Assert(pos <= size());
|
||||
#endif
|
||||
#ifndef HAVE_ROPE
|
||||
text.insert(text.begin() + pos, c);
|
||||
#else
|
||||
text.insert(pos, c);
|
||||
#endif
|
||||
// Update the font table.
|
||||
FontTable search_font(pos, LyXFont());
|
||||
for (FontList::iterator it = lower_bound(fontlist.begin(),
|
||||
@ -656,7 +666,7 @@ void LyXParagraph::InsertChar(LyXParagraph::size_type pos,
|
||||
void LyXParagraph::InsertInset(LyXParagraph::size_type pos,
|
||||
Inset * inset)
|
||||
{
|
||||
LyXFont f(LyXFont::ALL_INHERIT);
|
||||
LyXFont const f(LyXFont::ALL_INHERIT);
|
||||
InsertInset(pos, inset, f);
|
||||
}
|
||||
|
||||
@ -1155,34 +1165,35 @@ void LyXParagraph::SetFont(LyXParagraph::size_type pos,
|
||||
bool end = !notfound && fontlist[i].pos == pos;
|
||||
// Is position pos is the end of a font block?
|
||||
if (begin && end) { // A single char block
|
||||
if (i+1 < fontlist.size() &&
|
||||
fontlist[i+1].font == font) {
|
||||
if (i + 1 < fontlist.size() &&
|
||||
fontlist[i + 1].font == font) {
|
||||
// Merge the singleton block with the next block
|
||||
fontlist.erase(fontlist.begin() + i);
|
||||
if (i > 0 && fontlist[i-1].font == font)
|
||||
if (i > 0 && fontlist[i - 1].font == font)
|
||||
fontlist.erase(fontlist.begin() + i-1);
|
||||
} else if (i > 0 && fontlist[i-1].font == font) {
|
||||
} else if (i > 0 && fontlist[i - 1].font == font) {
|
||||
// Merge the singleton block with the previous block
|
||||
fontlist[i-1].pos = pos;
|
||||
fontlist[i - 1].pos = pos;
|
||||
fontlist.erase(fontlist.begin() + i);
|
||||
} else
|
||||
fontlist[i].font = font;
|
||||
} else if (begin) {
|
||||
if (i > 0 && fontlist[i-1].font == font)
|
||||
fontlist[i-1].pos = pos;
|
||||
if (i > 0 && fontlist[i - 1].font == font)
|
||||
fontlist[i - 1].pos = pos;
|
||||
else
|
||||
fontlist.insert(fontlist.begin() + i,
|
||||
FontTable(pos, font));
|
||||
} else if (end) {
|
||||
fontlist[i].pos = pos - 1;
|
||||
if (!(i+1 < fontlist.size() &&
|
||||
fontlist[i+1].font == font))
|
||||
fontlist.insert(fontlist.begin() + i+1,
|
||||
if (!(i + 1 < fontlist.size() &&
|
||||
fontlist[i + 1].font == font))
|
||||
fontlist.insert(fontlist.begin() + i + 1,
|
||||
FontTable(pos, font));
|
||||
} else { // The general case. The block is splitted into 3 blocks
|
||||
fontlist.insert(fontlist.begin() + i,
|
||||
FontTable(pos - 1, fontlist[i].font));
|
||||
fontlist.insert(fontlist.begin() + i+1, FontTable(pos, font));
|
||||
fontlist.insert(fontlist.begin() + i + 1,
|
||||
FontTable(pos, font));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1469,11 +1480,13 @@ void LyXParagraph::BreakParagraph(BufferParams const & bparams,
|
||||
if (tmp->InsertFromMinibuffer(j - pos))
|
||||
++j;
|
||||
}
|
||||
tmp->text.resize(tmp->text.size());
|
||||
|
||||
tmp->fitToSize();
|
||||
|
||||
for (i = pos_end; i >= pos; --i)
|
||||
par->Erase(i - pos_first);
|
||||
|
||||
par->text.resize(par->text.size());
|
||||
par->fitToSize();
|
||||
#else
|
||||
size_type pos_end = text.size() - 1;
|
||||
|
||||
@ -1692,11 +1705,13 @@ void LyXParagraph::BreakParagraphConservative(BufferParams const & bparams,
|
||||
if (tmp->InsertFromMinibuffer(j - pos))
|
||||
++j;
|
||||
}
|
||||
tmp->text.resize(tmp->text.size());
|
||||
|
||||
tmp->fitToSize();
|
||||
|
||||
for (size_type i = pos_end; i >= pos; --i)
|
||||
par->Erase(i - pos_first);
|
||||
|
||||
par->text.resize(par->text.size());
|
||||
par->fitToSize();
|
||||
}
|
||||
#else
|
||||
// create a new paragraph
|
||||
@ -1962,9 +1977,8 @@ void LyXParagraph::SetOnlyLayout(BufferParams const & bparams,
|
||||
}
|
||||
if ((par->pextra_type == PEXTRA_NONE) &&
|
||||
npar && (npar->pextra_type != PEXTRA_NONE)) {
|
||||
string
|
||||
p1 = npar->pextra_width,
|
||||
p2 = npar->pextra_widthp;
|
||||
string const p1 = npar->pextra_width;
|
||||
string const p2 = npar->pextra_widthp;
|
||||
npar->SetPExtraType(bparams, npar->pextra_type,
|
||||
p1, p2);
|
||||
}
|
||||
@ -2023,17 +2037,15 @@ void LyXParagraph::SetLayout(BufferParams const & bparams,
|
||||
#endif
|
||||
}
|
||||
if (ppar && (ppar->pextra_type != PEXTRA_NONE)) {
|
||||
string
|
||||
p1 = ppar->pextra_width,
|
||||
p2 = ppar->pextra_widthp;
|
||||
string const p1 = ppar->pextra_width;
|
||||
string const p2 = ppar->pextra_widthp;
|
||||
ppar->SetPExtraType(bparams, ppar->pextra_type,
|
||||
p1, p2);
|
||||
}
|
||||
if ((par->pextra_type == PEXTRA_NONE) &&
|
||||
npar && (npar->pextra_type != PEXTRA_NONE)) {
|
||||
string
|
||||
p1 = npar->pextra_width,
|
||||
p2 = npar->pextra_widthp;
|
||||
string const p1 = npar->pextra_width;
|
||||
string const p2 = npar->pextra_widthp;
|
||||
npar->SetPExtraType(bparams, npar->pextra_type,
|
||||
p1, p2);
|
||||
}
|
||||
@ -2062,7 +2074,8 @@ int LyXParagraph::BeginningOfMainBody() const
|
||||
&& GetChar(i) != LyXParagraph::META_NEWLINE
|
||||
) {
|
||||
++i;
|
||||
char previous_char = 0, temp = 0;
|
||||
char previous_char = 0;
|
||||
char temp = 0;
|
||||
if (i < size()
|
||||
&& (previous_char = GetChar(i)) != LyXParagraph::META_NEWLINE) {
|
||||
// Yes, this ^ is supposed to be "= " not "=="
|
||||
@ -2194,7 +2207,7 @@ int LyXParagraph::GetPositionOfInset(Inset * inset) const
|
||||
// Think about footnotes.
|
||||
if (footnoteflag == LyXParagraph::NO_FOOTNOTE
|
||||
&& next && next->footnoteflag == LyXParagraph::CLOSED_FOOTNOTE) {
|
||||
int further =
|
||||
int const further =
|
||||
NextAfterFootnote()->GetPositionOfInset(inset);
|
||||
if (further != -1)
|
||||
return text.size() + 1 + further;
|
||||
@ -2811,7 +2824,7 @@ void LyXParagraph::SimpleTeXSpecialChars(Buffer const * buf,
|
||||
Inset * inset = GetInset(i);
|
||||
if (inset) {
|
||||
bool close = false;
|
||||
int len = os.tellp();
|
||||
int const len = os.tellp();
|
||||
if ((inset->LyxCode() == Inset::GRAPHICS_CODE
|
||||
|| inset->LyxCode() == Inset::MATH_CODE
|
||||
|| inset->LyxCode() == Inset::URL_CODE)
|
||||
@ -3838,14 +3851,14 @@ bool LyXParagraph::IsKomma(size_type pos) const
|
||||
/// Used by the spellchecker
|
||||
bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) const
|
||||
{
|
||||
value_type c = GetChar(pos);
|
||||
value_type const c = GetChar(pos);
|
||||
if (IsLetterChar(c))
|
||||
return true;
|
||||
// '\0' is not a letter, allthough every string contains "" (below)
|
||||
if (c == '\0')
|
||||
return false;
|
||||
// We want to pass the ' and escape chars to ispell
|
||||
string extra = lyxrc.isp_esc_chars + '\'';
|
||||
string const extra = lyxrc.isp_esc_chars + '\'';
|
||||
char ch[2] = { c, 0 };
|
||||
return contains(extra, ch);
|
||||
}
|
||||
@ -3925,7 +3938,7 @@ string const LyXParagraph::String(Buffer const * buffer, bool label)
|
||||
if (label && !labelstring.empty())
|
||||
#endif
|
||||
s += labelstring + ' ';
|
||||
string::size_type len = s.size();
|
||||
string::size_type const len = s.size();
|
||||
|
||||
for (LyXParagraph::size_type i = 0; i < size(); ++i) {
|
||||
value_type c = GetChar(i);
|
||||
|
72
src/screen.C
72
src/screen.C
@ -24,6 +24,7 @@
|
||||
#include "buffer.h"
|
||||
#include "font.h"
|
||||
#include "insets/insettext.h"
|
||||
#include "ColorHandler.h"
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
@ -35,7 +36,7 @@ GC createGC()
|
||||
val.foreground = BlackPixel(fl_get_display(),
|
||||
DefaultScreen(fl_get_display()));
|
||||
|
||||
val.function=GXcopy;
|
||||
val.function = GXcopy;
|
||||
val.graphics_exposures = false;
|
||||
val.line_style = LineSolid;
|
||||
val.line_width = 0;
|
||||
@ -46,8 +47,8 @@ GC createGC()
|
||||
|
||||
|
||||
// Constructor
|
||||
LyXScreen::LyXScreen(WorkArea & o) //, LyXText * text_ptr)
|
||||
: owner(o), force_clear(true) //, text(text_ptr)
|
||||
LyXScreen::LyXScreen(WorkArea & o)
|
||||
: owner(o), force_clear(true)
|
||||
{
|
||||
// the cursor isnt yet visible
|
||||
cursor_visible = false;
|
||||
@ -62,6 +63,19 @@ LyXScreen::LyXScreen(WorkArea & o) //, LyXText * text_ptr)
|
||||
}
|
||||
|
||||
|
||||
void LyXScreen::setCursorColor()
|
||||
{
|
||||
if (!lyxColorHandler) return;
|
||||
|
||||
GC gc = lyxColorHandler->getGCForeground(LColor::cursor);
|
||||
|
||||
XGCValues val;
|
||||
XGetGCValues(fl_get_display(),
|
||||
gc, GCForeground, &val);
|
||||
XChangeGC(fl_get_display(), gc_copy, GCForeground, &val);
|
||||
}
|
||||
|
||||
|
||||
void LyXScreen::Redraw(LyXText * text)
|
||||
{
|
||||
DrawFromTo(text, 0, owner.height());
|
||||
@ -102,7 +116,7 @@ void LyXScreen::DrawFromTo(LyXText * text,
|
||||
LyXText::text_status st = text->status;
|
||||
do {
|
||||
text->status = st;
|
||||
text->GetVisibleRow(owner.owner(), y+y_offset,
|
||||
text->GetVisibleRow(owner.owner(), y + y_offset,
|
||||
x_offset, row, y + text->first);
|
||||
} while (text->status == LyXText::CHANGED_IN_DRAW);
|
||||
text->status = st;
|
||||
@ -124,7 +138,7 @@ void LyXScreen::DrawFromTo(LyXText * text,
|
||||
void LyXScreen::DrawOneRow(LyXText * text, Row * row, int y_text,
|
||||
int y_offset, int x_offset)
|
||||
{
|
||||
int y = y_text - text->first + y_offset;
|
||||
int const y = y_text - text->first + y_offset;
|
||||
|
||||
if (((y + row->height()) > 0) &&
|
||||
((y - row->height()) <= static_cast<int>(owner.height()))) {
|
||||
@ -147,7 +161,7 @@ void LyXScreen::Draw(LyXText * text, unsigned int y)
|
||||
{
|
||||
if (cursor_visible) HideCursor();
|
||||
|
||||
int old_first = text->first;
|
||||
int const old_first = text->first;
|
||||
text->first = y;
|
||||
|
||||
// is any optimiziation possible?
|
||||
@ -241,11 +255,15 @@ bool LyXScreen::FitManualCursor(LyXText * text,
|
||||
void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
|
||||
int asc, int desc, Cursor_Shape shape)
|
||||
{
|
||||
int y1 = max(y - text->first - asc, 0);
|
||||
int y2 = min(y - text->first + desc, static_cast<int>(owner.height()));
|
||||
// Update the cursor color.
|
||||
setCursorColor();
|
||||
|
||||
int const y1 = max(y - text->first - asc, 0);
|
||||
int const y_tmp = min(y - text->first + desc,
|
||||
static_cast<int>(owner.height()));
|
||||
|
||||
// Secure against very strange situations
|
||||
y2 = max(y2, y1);
|
||||
int const y2 = max(y_tmp, y1);
|
||||
|
||||
if (cursor_pixmap){
|
||||
XFreePixmap(fl_get_display(), cursor_pixmap);
|
||||
@ -298,7 +316,7 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
|
||||
break;
|
||||
case L_SHAPE:
|
||||
case REVERSED_L_SHAPE:
|
||||
int rectangle_h = (cursor_pixmap_h+10)/20;
|
||||
int const rectangle_h = (cursor_pixmap_h + 10) / 20;
|
||||
XFillRectangle(fl_get_display(),
|
||||
owner.getWin(),
|
||||
gc_copy,
|
||||
@ -380,8 +398,8 @@ unsigned int LyXScreen::TopCursorVisible(LyXText const * text)
|
||||
bool LyXScreen::FitCursor(LyXText * text)
|
||||
{
|
||||
// Is a change necessary?
|
||||
int newtop = TopCursorVisible(text);
|
||||
bool result = (newtop != text->first);
|
||||
int const newtop = TopCursorVisible(text);
|
||||
bool const result = (newtop != text->first);
|
||||
if (result)
|
||||
Draw(text, newtop);
|
||||
return result;
|
||||
@ -393,7 +411,7 @@ void LyXScreen::Update(LyXText * text, int y_offset, int x_offset)
|
||||
switch (text->status) {
|
||||
case LyXText::NEED_MORE_REFRESH:
|
||||
{
|
||||
int y = max(int(text->refresh_y - text->first), 0);
|
||||
int const y = max(int(text->refresh_y - text->first), 0);
|
||||
DrawFromTo(text, y, owner.height(), y_offset, x_offset);
|
||||
text->refresh_y = 0;
|
||||
text->status = LyXText::UNCHANGED;
|
||||
@ -424,15 +442,17 @@ void LyXScreen::ToggleSelection(LyXText * text, bool kill_selection,
|
||||
// only if there is a selection
|
||||
if (!text->selection) return;
|
||||
|
||||
int bottom = min(max(static_cast<int>(text->sel_end_cursor.y()
|
||||
- text->sel_end_cursor.row()->baseline()
|
||||
+ text->sel_end_cursor.row()->height()),
|
||||
text->first),
|
||||
static_cast<int>(text->first + owner.height()));
|
||||
int top = min(max(static_cast<int>(text->sel_start_cursor.y() -
|
||||
text->sel_start_cursor.row()->baseline()),
|
||||
text->first),
|
||||
static_cast<int>(text->first + owner.height()));
|
||||
int const bottom = min(
|
||||
max(static_cast<int>(text->sel_end_cursor.y()
|
||||
- text->sel_end_cursor.row()->baseline()
|
||||
+ text->sel_end_cursor.row()->height()),
|
||||
text->first),
|
||||
static_cast<int>(text->first + owner.height()));
|
||||
int const top = min(
|
||||
max(static_cast<int>(text->sel_start_cursor.y() -
|
||||
text->sel_start_cursor.row()->baseline()),
|
||||
text->first),
|
||||
static_cast<int>(text->first + owner.height()));
|
||||
|
||||
if (kill_selection)
|
||||
text->selection = 0;
|
||||
@ -450,15 +470,15 @@ void LyXScreen::ToggleToggle(LyXText * text, int y_offset, int x_offset)
|
||||
&& text->toggle_cursor.pos() == text->toggle_end_cursor.pos())
|
||||
return;
|
||||
|
||||
int top = text->toggle_cursor.y()
|
||||
int const top_tmp = text->toggle_cursor.y()
|
||||
- text->toggle_cursor.row()->baseline();
|
||||
int bottom = text->toggle_end_cursor.y()
|
||||
int const bottom_tmp = text->toggle_end_cursor.y()
|
||||
- text->toggle_end_cursor.row()->baseline()
|
||||
+ text->toggle_end_cursor.row()->height();
|
||||
|
||||
bottom = min(max(bottom, text->first),
|
||||
int const bottom = min(max(bottom_tmp, text->first),
|
||||
static_cast<int>(text->first + owner.height()));
|
||||
top = min(max(top, text->first),
|
||||
int const top = min(max(top_tmp, text->first),
|
||||
static_cast<int>(text->first + owner.height()));
|
||||
|
||||
DrawFromTo(text, top - text->first, bottom - text->first, y_offset,
|
||||
|
@ -1135,151 +1135,3 @@ void removeAutosaveFile(string const & filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool WriteableDir(string const & name, string & errorMessage)
|
||||
{
|
||||
errorMessage.erase();
|
||||
|
||||
if (!AbsolutePath(name)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo const tp(name);
|
||||
if (!tp.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tp.writable()) {
|
||||
errorMessage = N_("Cannot write to this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ReadableDir(string const & name, string & errorMessage)
|
||||
{
|
||||
errorMessage.erase();
|
||||
|
||||
if (!AbsolutePath(name)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo const tp(name);
|
||||
if (!tp.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tp.readable()) {
|
||||
errorMessage = N_("Cannot read this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool WriteableFile(string const & name, string & errorMessage)
|
||||
{
|
||||
// A writeable file is either:
|
||||
// * An existing file to which we have write access, or
|
||||
// * A file that doesn't yet exist but that would exist in a writeable
|
||||
// directory.
|
||||
|
||||
errorMessage.erase();
|
||||
|
||||
if (name.empty()) {
|
||||
errorMessage = N_("No file input.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string const dir = OnlyPath(name);
|
||||
if (!AbsolutePath(dir)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo d(name);
|
||||
if (!d.isDir()) {
|
||||
d.newFile(dir);
|
||||
}
|
||||
|
||||
if (!d.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.writable()) {
|
||||
errorMessage = N_("Cannot write to this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo f(name);
|
||||
if (dir == name || f.isDir()) {
|
||||
errorMessage = N_("A file is required, not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (f.exist() && !f.writable()) {
|
||||
errorMessage = N_("Cannot write to this file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ReadableFile(string const & name, string & errorMessage)
|
||||
{
|
||||
errorMessage.erase();
|
||||
|
||||
if (name.empty()) {
|
||||
errorMessage = N_("No file input.");
|
||||
return false;
|
||||
}
|
||||
|
||||
string const dir = OnlyPath(name);
|
||||
if (!AbsolutePath(dir)) {
|
||||
errorMessage = N_("The absolute path is required.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo d(name);
|
||||
if (!d.isDir()) {
|
||||
d.newFile(dir);
|
||||
}
|
||||
|
||||
if (!d.isDir()) {
|
||||
errorMessage = N_("Directory does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!d.readable()) {
|
||||
errorMessage = N_("Cannot read from this directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
FileInfo f(name);
|
||||
if (dir == name || f.isDir()) {
|
||||
errorMessage = N_("A file is required, not a directory.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.exist()) {
|
||||
errorMessage = N_("File does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!f.readable()) {
|
||||
errorMessage = N_("Cannot read from this file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -205,16 +205,4 @@ string const findtexfile(string const & fil, string const & format);
|
||||
/// remove the autosave-file and give a Message if it can't be done
|
||||
void removeAutosaveFile(string const & filename);
|
||||
|
||||
/** Perform some quite detailed tests to ascertain whether the directory or
|
||||
file is readable or writeable. If not, then an error message is returned.
|
||||
*/
|
||||
///
|
||||
bool WriteableDir(string const & dir, string & errorMessage);
|
||||
///
|
||||
bool ReadableDir(string const & dir, string & errorMessage);
|
||||
///
|
||||
bool WriteableFile(string const & file, string & errorMessage);
|
||||
///
|
||||
bool ReadableFile(string const & file, string & errorMessage);
|
||||
|
||||
#endif
|
||||
|
@ -92,7 +92,9 @@ LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
|
||||
{
|
||||
owner_ = inset;
|
||||
Init(lt.rows_, lt.columns_);
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Jürgen, can you make it the other way round. So that copy assignment depends on the copy constructor and not the other way. (Lgb)
|
||||
#endif
|
||||
operator=(lt);
|
||||
}
|
||||
|
||||
@ -342,7 +344,9 @@ void LyXTabular::set_row_column_number_info(bool oldformat)
|
||||
}
|
||||
#else
|
||||
// Isn't this the same as the while above? (Lgb)
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Please check this Jürgen.
|
||||
#endif
|
||||
// if ok please delete the #if 0 section above. (Lgb)
|
||||
for (int row = 0, column = 0, c = 0;
|
||||
c < numberofcells && row < rows_ && column < columns_;) {
|
||||
@ -2386,7 +2390,9 @@ int LyXTabular::AsciiTopHLine(ostream & os, int row,
|
||||
return 0;
|
||||
#else
|
||||
// Isn't this equivalent? (Lgb)
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Please check this Jürgen.
|
||||
#endif
|
||||
// If ok please delete the abofe #if 0 section. (Lgb)
|
||||
for (int i = fcell; i < n; ++i) {
|
||||
if (TopLine(i))
|
||||
@ -2442,7 +2448,9 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row,
|
||||
return 0;
|
||||
#else
|
||||
// Isn't this equivalent? (Lgb)
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Please check this Jürgen.
|
||||
#endif
|
||||
// If ok, please delete the above #if 0 section. (Lgb)
|
||||
for (int i = fcell; i < n; ++i) {
|
||||
if (BottomLine(i))
|
||||
|
182
src/text.C
182
src/text.C
@ -63,7 +63,7 @@ unsigned char LyXText::TransformChar(unsigned char c, LyXParagraph * par,
|
||||
else
|
||||
return c;
|
||||
|
||||
unsigned char prev_char = pos > 0 ? par->GetChar(pos-1) : ' ';
|
||||
unsigned char const prev_char = pos > 0 ? par->GetChar(pos-1) : ' ';
|
||||
unsigned char next_char = ' ';
|
||||
for (LyXParagraph::size_type i = pos+1; i < par->Last(); ++i)
|
||||
if (!Encodings::IsComposeChar_arabic(par->GetChar(i))) {
|
||||
@ -207,7 +207,7 @@ LyXParagraph::size_type LyXText::RowLast(Row const * row) const
|
||||
|
||||
LyXParagraph::size_type LyXText::RowLastPrintable(Row const * row) const
|
||||
{
|
||||
LyXParagraph::size_type last = RowLast(row);
|
||||
LyXParagraph::size_type const last = RowLast(row);
|
||||
if (last >= row->pos()
|
||||
&& row->next()
|
||||
&& row->next()->par() == row->par()
|
||||
@ -248,16 +248,18 @@ void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
|
||||
log2vis_list[bidi_end + 1 - bidi_start] = -1;
|
||||
|
||||
LyXParagraph::size_type stack[2];
|
||||
bool rtl_par = row->par()->getParLanguage(buf->params)->RightToLeft();
|
||||
bool const rtl_par =
|
||||
row->par()->getParLanguage(buf->params)->RightToLeft();
|
||||
int level = 0;
|
||||
bool rtl = false;
|
||||
bool rtl0 = false;
|
||||
LyXParagraph::size_type main_body = BeginningOfMainBody(buf, row->par());
|
||||
LyXParagraph::size_type const main_body =
|
||||
BeginningOfMainBody(buf, row->par());
|
||||
|
||||
for (LyXParagraph::size_type lpos = bidi_start;
|
||||
lpos <= bidi_end; ++lpos) {
|
||||
bool is_space = row->par()->IsLineSeparator(lpos);
|
||||
LyXParagraph::size_type pos =
|
||||
LyXParagraph::size_type const pos =
|
||||
(is_space && lpos + 1 <= bidi_end &&
|
||||
!row->par()->IsLineSeparator(lpos + 1) &&
|
||||
!row->par()->IsNewline(lpos + 1))
|
||||
@ -321,7 +323,7 @@ void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
|
||||
}
|
||||
|
||||
while (level > 0) {
|
||||
LyXParagraph::size_type old_lpos = stack[--level];
|
||||
LyXParagraph::size_type const old_lpos = stack[--level];
|
||||
int delta = bidi_end - old_lpos;
|
||||
if (level % 2)
|
||||
delta = -delta;
|
||||
@ -388,10 +390,10 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
if (IsNewlineChar(c)) {
|
||||
++vpos;
|
||||
// Draw end-of-line marker
|
||||
LyXFont font = GetFont(bview->buffer(), row->par(), pos);
|
||||
int wid = lyxfont::width('n', font);
|
||||
int asc = lyxfont::maxAscent(font);
|
||||
int y = offset + row->baseline();
|
||||
LyXFont const font = GetFont(bview->buffer(), row->par(), pos);
|
||||
int const wid = lyxfont::width('n', font);
|
||||
int const asc = lyxfont::maxAscent(font);
|
||||
int const y = offset + row->baseline();
|
||||
int xp[3], yp[3];
|
||||
|
||||
if (bidi_level(pos) % 2 == 0) {
|
||||
@ -481,8 +483,8 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
font.decSize();
|
||||
|
||||
// calculate the position of the footnotemark
|
||||
int y = (row->baseline() - lyxfont::maxAscent(font2)
|
||||
+ lyxfont::maxAscent(font));
|
||||
int const y = (row->baseline() - lyxfont::maxAscent(font2)
|
||||
+ lyxfont::maxAscent(font));
|
||||
|
||||
font.setColor(LColor::footnote);
|
||||
|
||||
@ -513,7 +515,7 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
|
||||
if (lyxrc.mark_foreign_language &&
|
||||
font.language() != bview->buffer()->params.language) {
|
||||
int y = offset + row->height() - 1;
|
||||
int const y = offset + row->height() - 1;
|
||||
pain.line(int(tmpx), y, int(x), y,
|
||||
LColor::language);
|
||||
}
|
||||
@ -538,17 +540,20 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
textstring = c;
|
||||
++vpos;
|
||||
|
||||
LyXParagraph::size_type last = RowLastPrintable(row);
|
||||
LyXParagraph::size_type const last = RowLastPrintable(row);
|
||||
|
||||
if (font.language()->lang() == "hebrew") {
|
||||
if (Encodings::IsComposeChar_hebrew(c)) {
|
||||
int width = lyxfont::width(c, font2);
|
||||
int const width = lyxfont::width(c, font2);
|
||||
int dx = 0;
|
||||
for (LyXParagraph::size_type i = pos-1; i >= 0; --i) {
|
||||
c = row->par()->GetChar(i);
|
||||
if (!Encodings::IsComposeChar_hebrew(c)) {
|
||||
if (IsPrintableNonspace(c)) {
|
||||
int width2 = SingleWidth(bview, row->par(), i, c);
|
||||
int const width2 =
|
||||
SingleWidth(bview,
|
||||
row->par(),
|
||||
i, c);
|
||||
dx = (c == 'ø' || c == 'ã') // dalet / resh
|
||||
? width2 - width : (width2 - width) / 2;
|
||||
}
|
||||
@ -578,13 +583,16 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
if (Encodings::IsComposeChar_arabic(c)) {
|
||||
c = TransformChar(c, row->par(), pos);
|
||||
textstring = c;
|
||||
int width = lyxfont::width(c, font2);
|
||||
int const width = lyxfont::width(c, font2);
|
||||
int dx = 0;
|
||||
for (LyXParagraph::size_type i = pos-1; i >= 0; --i) {
|
||||
c = row->par()->GetChar(i);
|
||||
if (!Encodings::IsComposeChar_arabic(c)) {
|
||||
if (IsPrintableNonspace(c)) {
|
||||
int width2 = SingleWidth(bview, row->par(), i, c);
|
||||
int const width2 =
|
||||
SingleWidth(bview,
|
||||
row->par(),
|
||||
i, c);
|
||||
dx = (width2 - width) / 2;
|
||||
}
|
||||
break;
|
||||
@ -624,7 +632,7 @@ void LyXText::draw(BufferView * bview, Row const * row,
|
||||
|
||||
if (lyxrc.mark_foreign_language &&
|
||||
font.language() != bview->buffer()->params.language) {
|
||||
int y = offset + row->height() - 1;
|
||||
int const y = offset + row->height() - 1;
|
||||
pain.line(int(tmpx), y, int(x), y,
|
||||
LColor::language);
|
||||
}
|
||||
@ -956,7 +964,7 @@ int LyXText::RightMargin(Buffer const * buf, Row const * row) const
|
||||
}
|
||||
|
||||
|
||||
int LyXText::LabelEnd (BufferView * bview, Row const * row) const
|
||||
int LyXText::LabelEnd(BufferView * bview, Row const * row) const
|
||||
{
|
||||
if (textclasslist.Style(bview->buffer()->params.textclass,
|
||||
row->par()->GetLayout()).margintype
|
||||
@ -978,17 +986,20 @@ LyXParagraph::size_type
|
||||
LyXText::NextBreakPoint(BufferView * bview, Row const * row, int width) const
|
||||
{
|
||||
LyXParagraph * par = row->par();
|
||||
LyXParagraph::size_type pos = row->pos();
|
||||
|
||||
if (width < 0)
|
||||
return par->Last();
|
||||
|
||||
LyXParagraph::size_type const pos = row->pos();
|
||||
|
||||
|
||||
// position of the last possible breakpoint
|
||||
// -1 isn't a suitable value, but a flag
|
||||
LyXParagraph::size_type last_separator = -1;
|
||||
width -= RightMargin(bview->buffer(), row);
|
||||
|
||||
LyXParagraph::size_type main_body = BeginningOfMainBody(bview->buffer(), par);
|
||||
LyXParagraph::size_type const main_body =
|
||||
BeginningOfMainBody(bview->buffer(), par);
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(bview->buffer()->params.textclass, par->GetLayout());
|
||||
LyXParagraph::size_type i = pos;
|
||||
@ -1015,7 +1026,7 @@ LyXText::NextBreakPoint(BufferView * bview, Row const * row, int width) const
|
||||
bool doitonetime = true;
|
||||
while (doitonetime || ((x < width) && (i < last))) {
|
||||
doitonetime = false;
|
||||
char c = par->GetChar(i);
|
||||
char const c = par->GetChar(i);
|
||||
if (IsNewlineChar(c)) {
|
||||
last_separator = i;
|
||||
x = width; // this means break
|
||||
@ -1096,13 +1107,13 @@ int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const
|
||||
|
||||
int w;
|
||||
// get the pure distance
|
||||
LyXParagraph::size_type last = RowLastPrintable(row);
|
||||
LyXParagraph::size_type const last = RowLastPrintable(row);
|
||||
|
||||
// special handling of the right address boxes
|
||||
if (textclasslist.Style(bview->buffer()->params.textclass,
|
||||
row->par()->GetLayout()).margintype
|
||||
== MARGIN_RIGHT_ADDRESS_BOX) {
|
||||
int tmpfill = row->fill();
|
||||
int const tmpfill = row->fill();
|
||||
row->fill(0); // the minfill in MarginLeft()
|
||||
w = LeftMargin(bview, row);
|
||||
row->fill(tmpfill);
|
||||
@ -1111,7 +1122,7 @@ int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const
|
||||
|
||||
LyXLayout const & layout = textclasslist.Style(bview->buffer()->params.textclass,
|
||||
row->par()->GetLayout());
|
||||
LyXParagraph::size_type main_body =
|
||||
LyXParagraph::size_type const main_body =
|
||||
BeginningOfMainBody(bview->buffer(), row->par());
|
||||
LyXParagraph::size_type i = row->pos();
|
||||
|
||||
@ -1131,7 +1142,7 @@ int LyXText::Fill(BufferView * bview, Row * row, int paper_width) const
|
||||
w += lyxfont::width(layout.labelsep, GetFont(bview->buffer(), row->par(), -2));
|
||||
if (last >= 0 && row->par()->IsLineSeparator(last))
|
||||
w -= SingleWidth(bview, row->par(), last);
|
||||
int left_margin = LabelEnd(bview, row);
|
||||
int const left_margin = LabelEnd(bview, row);
|
||||
if (w < left_margin)
|
||||
w = left_margin;
|
||||
}
|
||||
@ -1313,7 +1324,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
firstpar->GetLayout());
|
||||
|
||||
LyXFont font = GetFont(bview->buffer(), par, par->Last() - 1);
|
||||
LyXFont::FONT_SIZE size = font.size();
|
||||
LyXFont::FONT_SIZE const size = font.size();
|
||||
font = GetFont(bview->buffer(), par, -1);
|
||||
font.setSize(size);
|
||||
|
||||
@ -1333,7 +1344,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
int maxdesc = int(lyxfont::maxDescent(font) *
|
||||
layout.spacing.getValue() *
|
||||
spacing_val);
|
||||
int pos_end = RowLast(row_ptr);
|
||||
int const pos_end = RowLast(row_ptr);
|
||||
int labeladdon = 0;
|
||||
int maxwidth = 0;
|
||||
|
||||
@ -1358,7 +1369,7 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
|
||||
// Check if any custom fonts are larger (Asger)
|
||||
// This is not completely correct, but we can live with the small,
|
||||
// cosmetic error for now.
|
||||
LyXFont::FONT_SIZE maxsize =
|
||||
LyXFont::FONT_SIZE const maxsize =
|
||||
row_ptr->par()->HighestFontInRange(row_ptr->pos(),
|
||||
pos_end);
|
||||
if (maxsize > font.size()) {
|
||||
@ -1764,8 +1775,8 @@ void LyXText::BreakParagraph(BufferView * bview, char keep_layout)
|
||||
* move one row up!
|
||||
* This touches only the screen-update. Otherwise we would may have
|
||||
* an empty row on the screen */
|
||||
if (cursor.pos() && !cursor.row()->par()->IsNewline(cursor.row()->pos() - 1) &&
|
||||
cursor.row()->pos() == cursor.pos()) {
|
||||
if (cursor.pos() && !cursor.row()->par()->IsNewline(cursor.row()->pos() - 1)
|
||||
&& cursor.row()->pos() == cursor.pos()) {
|
||||
CursorLeft(bview);
|
||||
}
|
||||
|
||||
@ -1894,7 +1905,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
|
||||
// When the free-spacing option is set for the current layout,
|
||||
// disable the double-space checking
|
||||
|
||||
bool freeSpacing =
|
||||
bool const freeSpacing =
|
||||
textclasslist.Style(bview->buffer()->params.textclass,
|
||||
cursor.row()->par()->GetLayout()).free_spacing;
|
||||
|
||||
@ -1918,7 +1929,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
|
||||
Number(bview); // Set current_font.number to ON
|
||||
|
||||
if (cursor.pos() > 0) {
|
||||
char c = cursor.par()->GetChar(cursor.pos() - 1);
|
||||
char const c = cursor.par()->GetChar(cursor.pos() - 1);
|
||||
if (strchr("+-",c) &&
|
||||
(cursor.pos() == 1 ||
|
||||
cursor.par()->IsSeparator(cursor.pos() - 2) ||
|
||||
@ -1962,7 +1973,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
|
||||
* current font */
|
||||
|
||||
// Get the font that is used to calculate the baselineskip
|
||||
LyXParagraph::size_type lastpos = cursor.par()->Last();
|
||||
LyXParagraph::size_type const lastpos = cursor.par()->Last();
|
||||
LyXFont rawparfont = cursor.par()->GetFontSettings(bview->buffer()->params,
|
||||
lastpos - 1);
|
||||
|
||||
@ -2112,7 +2123,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
|
||||
refresh_row = row;
|
||||
refresh_pos = cursor.pos();
|
||||
|
||||
int tmpheight = row->height();
|
||||
int const tmpheight = row->height();
|
||||
SetHeightOfRow(bview, row);
|
||||
if (tmpheight == row->height())
|
||||
status = LyXText::NEED_VERY_LITTLE_REFRESH;
|
||||
@ -2171,7 +2182,8 @@ void LyXText::PrepareToPrint(BufferView * bview,
|
||||
fill_separator = 0;
|
||||
fill_label_hfill = 0;
|
||||
|
||||
bool is_rtl = row->par()->isRightToLeftPar(bview->buffer()->params);
|
||||
bool const is_rtl =
|
||||
row->par()->isRightToLeftPar(bview->buffer()->params);
|
||||
#ifndef NEW_INSETS
|
||||
|
||||
if (is_rtl) {
|
||||
@ -2629,8 +2641,8 @@ void LyXText::Delete(BufferView * bview)
|
||||
// this is a very easy implementation
|
||||
|
||||
LyXCursor old_cursor = cursor;
|
||||
int old_cur_par_id = old_cursor.par()->id();
|
||||
int old_cur_par_prev_id = old_cursor.par()->previous ?
|
||||
int const old_cur_par_id = old_cursor.par()->id();
|
||||
int const old_cur_par_prev_id = old_cursor.par()->previous ?
|
||||
old_cursor.par()->previous->id() : 0;
|
||||
|
||||
// just move to the right
|
||||
@ -2714,7 +2726,7 @@ void LyXText::Backspace(BufferView * bview)
|
||||
CursorLeft(bview);
|
||||
|
||||
// the layout things can change the height of a row !
|
||||
int tmpheight = cursor.row()->height();
|
||||
int const tmpheight = cursor.row()->height();
|
||||
SetHeightOfRow(bview, cursor.row());
|
||||
if (cursor.row()->height() != tmpheight) {
|
||||
refresh_y = cursor.y() - cursor.row()->baseline();
|
||||
@ -2973,7 +2985,7 @@ void LyXText::Backspace(BufferView * bview)
|
||||
} else {
|
||||
// set the dimensions of the row
|
||||
row->fill(Fill(bview, row, workWidth(bview)));
|
||||
int tmpheight = row->height();
|
||||
int const tmpheight = row->height();
|
||||
SetHeightOfRow(bview, row);
|
||||
if (tmpheight == row->height())
|
||||
status = LyXText::NEED_VERY_LITTLE_REFRESH;
|
||||
@ -3018,7 +3030,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
bool const is_rtl =
|
||||
row_ptr->par()->isRightToLeftPar(bview->buffer()->params);
|
||||
|
||||
LyXParagraph::size_type last = RowLastPrintable(row_ptr);
|
||||
LyXParagraph::size_type const last = RowLastPrintable(row_ptr);
|
||||
|
||||
LyXParagraph::size_type vpos, pos;
|
||||
float x;
|
||||
@ -3059,31 +3071,36 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
if (cleared) {
|
||||
clear_area = true;
|
||||
} else if (clear_area) {
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning Should be fixed with a lyxinset::clear_width(bv, font) function! (Jug)
|
||||
int w = (inset_owner ? inset_owner->width(bview, font)-2 : ww);
|
||||
#endif
|
||||
int const w = (inset_owner ?
|
||||
inset_owner->width(bview, font)-2 : ww);
|
||||
pain.fillRectangle(x_offset, y_offset, w, row_ptr->height());
|
||||
} else if (inset != 0) {
|
||||
int h = row_ptr->baseline() - inset->ascent(bview, font);
|
||||
if (h > 0) {
|
||||
int w = (inset_owner ?
|
||||
int const w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
pain.fillRectangle(x_offset, y_offset, w, h);
|
||||
}
|
||||
h += inset->ascent(bview, font) + inset->descent(bview, font);
|
||||
if ((row_ptr->height() - h) > 0) {
|
||||
int w = (inset_owner ?
|
||||
int const w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
pain.fillRectangle(x_offset,y_offset+h, w, row_ptr->height()-h);
|
||||
pain.fillRectangle(x_offset, y_offset + h,
|
||||
w, row_ptr->height() - h);
|
||||
}
|
||||
if (!inset_owner && !inset->display() && !inset->needFullRow())
|
||||
{
|
||||
int w = inset->width(bview, font) + int(x);
|
||||
int const w = inset->width(bview, font) + int(x);
|
||||
pain.fillRectangle(w, y_offset, ww - w, row_ptr->height());
|
||||
}
|
||||
}
|
||||
|
||||
if (selection) {
|
||||
int w = (inset_owner ? inset_owner->width(bview, font) : ww);
|
||||
int const w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
/* selection code */
|
||||
if (bidi_same_direction) {
|
||||
if (sel_start_cursor.row() == row_ptr &&
|
||||
@ -3152,7 +3169,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
|
||||
for (vpos = row_ptr->pos(); vpos <= last; ++vpos) {
|
||||
pos = vis2log(vpos);
|
||||
float old_tmpx = tmpx;
|
||||
float const old_tmpx = tmpx;
|
||||
if (main_body > 0 && pos == main_body-1) {
|
||||
tmpx += fill_label_hfill +
|
||||
lyxfont::width(textclasslist.Style(bview->buffer()->params.textclass,
|
||||
@ -3287,7 +3304,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
}
|
||||
|
||||
// Draw minipage line
|
||||
bool minipage = p->pextra_type == LyXParagraph::PEXTRA_MINIPAGE;
|
||||
bool const minipage =
|
||||
(p->pextra_type == LyXParagraph::PEXTRA_MINIPAGE);
|
||||
if (minipage)
|
||||
pain.line(LYX_PAPER_MARGIN/5, y_offset,
|
||||
LYX_PAPER_MARGIN/5,
|
||||
@ -3295,9 +3313,10 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
LColor::minipageline);
|
||||
|
||||
// Draw depth lines
|
||||
int depth = p->GetDepth();
|
||||
int const depth = p->GetDepth();
|
||||
for (int i = 1; i <= depth; ++i) {
|
||||
int line_x = (LYX_PAPER_MARGIN / 5) * (i + minipage);
|
||||
int const line_x = (LYX_PAPER_MARGIN / 5) *
|
||||
(i + minipage);
|
||||
pain.line(line_x, y_offset, line_x,
|
||||
y_offset + row_ptr->height() - 1,
|
||||
LColor::depthbar);
|
||||
@ -3308,8 +3327,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
font.setSize(LyXFont::SIZE_FOOTNOTE);
|
||||
|
||||
int box_x = LYX_PAPER_MARGIN;
|
||||
box_x += lyxfont::width(" wide-tab ", font);
|
||||
int const box_x = LYX_PAPER_MARGIN
|
||||
+ lyxfont::width(" wide-tab ", font);
|
||||
|
||||
pain.line(box_x, y_offset,
|
||||
workWidth(bview) - LYX_PAPER_MARGIN,
|
||||
@ -3332,7 +3351,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
}
|
||||
|
||||
// Draw minipage line
|
||||
bool minipage = firstpar->pextra_type == LyXParagraph::PEXTRA_MINIPAGE;
|
||||
bool const minipage =
|
||||
(firstpar->pextra_type == LyXParagraph::PEXTRA_MINIPAGE);
|
||||
if (minipage)
|
||||
pain.line(LYX_PAPER_MARGIN/5 + box_x, y_offset,
|
||||
LYX_PAPER_MARGIN/5 + box_x,
|
||||
@ -3340,7 +3360,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
LColor::minipageline);
|
||||
|
||||
// Draw depth lines
|
||||
int depth = firstpar->GetDepth();
|
||||
int const depth = firstpar->GetDepth();
|
||||
if (depth > 0) {
|
||||
int next_depth = 0;
|
||||
int prev_depth = 0;
|
||||
@ -3366,7 +3386,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
#endif
|
||||
|
||||
for (int i = 1; i <= depth; ++i) {
|
||||
int line_x = (LYX_PAPER_MARGIN / 5) * (i + minipage) + box_x;
|
||||
int const line_x = (LYX_PAPER_MARGIN / 5) *
|
||||
(i + minipage) + box_x;
|
||||
pain.line(line_x, y_offset, line_x,
|
||||
y_offset + row_ptr->height() - 1 - (i - next_depth - 1) * 3,
|
||||
LColor::depthbar);
|
||||
@ -3469,8 +3490,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
y_top += lyxfont::ascent('x',
|
||||
GetFont(bview->buffer(),
|
||||
row_ptr->par(), 0));
|
||||
int w = (inset_owner ? inset_owner->width(bview, font) : ww);
|
||||
int xp = static_cast<int>(inset_owner ? x : 0);
|
||||
int const w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
int const xp = static_cast<int>(inset_owner ? x : 0);
|
||||
pain.line(xp, y_offset + y_top,
|
||||
w, y_offset + y_top,
|
||||
LColor::topline,
|
||||
@ -3489,7 +3511,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
font = GetFont(bview->buffer(), row_ptr->par(), -2);
|
||||
if (!row_ptr->par()->GetLabelstring().empty()) {
|
||||
tmpx = x;
|
||||
string tmpstring = row_ptr->par()->GetLabelstring();
|
||||
string const tmpstring =
|
||||
row_ptr->par()->GetLabelstring();
|
||||
|
||||
if (layout.labeltype == LABEL_COUNTER_CHAPTER) {
|
||||
if (bview->buffer()->params.secnumdepth >= 0) {
|
||||
@ -3540,7 +3563,8 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
font = GetFont(bview->buffer(),
|
||||
row_ptr->par(), -2);
|
||||
if (!row_ptr->par()->GetLabelstring().empty()) {
|
||||
string tmpstring = row_ptr->par()->GetLabelstring();
|
||||
string const tmpstring =
|
||||
row_ptr->par()->GetLabelstring();
|
||||
float spacing_val = 1.0;
|
||||
if (!row_ptr->par()->spacing.isDefault()) {
|
||||
spacing_val = row_ptr->par()->spacing.getValue();
|
||||
@ -3650,26 +3674,30 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
/* draw a bottom line */
|
||||
y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||
par, par->Last() - 1));
|
||||
int w = (inset_owner ? inset_owner->width(bview, font) : ww);
|
||||
int xp = static_cast<int>(inset_owner ? x : 0);
|
||||
int const w = (inset_owner ?
|
||||
inset_owner->width(bview, font) : ww);
|
||||
int const xp = static_cast<int>(inset_owner ? x : 0);
|
||||
pain.line(xp, y_offset + y_bottom,
|
||||
w, y_offset + y_bottom,
|
||||
LColor::topline, Painter::line_solid,
|
||||
Painter::line_thick);
|
||||
y_bottom -= lyxfont::ascent('x', GetFont(bview->buffer(),
|
||||
par, par->Last() - 1));
|
||||
y_bottom -= lyxfont::ascent('x',
|
||||
GetFont(bview->buffer(),
|
||||
par,
|
||||
par->Last() - 1));
|
||||
}
|
||||
|
||||
// draw an endlabel
|
||||
int endlabel = row_ptr->par()->GetEndLabel(bview->buffer()->params);
|
||||
int const endlabel =
|
||||
row_ptr->par()->GetEndLabel(bview->buffer()->params);
|
||||
switch (endlabel) {
|
||||
case END_LABEL_BOX:
|
||||
case END_LABEL_FILLED_BOX:
|
||||
{
|
||||
LyXFont font = GetFont(bview->buffer(),
|
||||
row_ptr->par(), last);
|
||||
int size = int(0.75 * lyxfont::maxAscent(font));
|
||||
int y = (y_offset + row_ptr->baseline()) - size;
|
||||
LyXFont const font = GetFont(bview->buffer(),
|
||||
row_ptr->par(), last);
|
||||
int const size = int(0.75 * lyxfont::maxAscent(font));
|
||||
int const y = (y_offset + row_ptr->baseline()) - size;
|
||||
int x = is_rtl ? LYX_PAPER_MARGIN
|
||||
: ww - LYX_PAPER_MARGIN - size;
|
||||
#ifndef NEW_INSETS
|
||||
@ -3700,10 +3728,12 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
|
||||
case END_LABEL_STATIC:
|
||||
{
|
||||
LyXTextClass::LayoutList::size_type layout = row_ptr->par()->GetLayout();
|
||||
string tmpstring = textclasslist.Style(bview->buffer()->params.textclass,
|
||||
layout).endlabelstring();
|
||||
string const tmpstring = textclasslist.
|
||||
Style(bview->buffer()->params.textclass,
|
||||
layout).endlabelstring();
|
||||
font = GetFont(bview->buffer(), row_ptr->par(), -2);
|
||||
int tmpx = is_rtl ? int(x) - lyxfont::width(tmpstring, font)
|
||||
int const tmpx = is_rtl ?
|
||||
int(x) - lyxfont::width(tmpstring, font)
|
||||
: ww - RightMargin(bview->buffer(), row_ptr) - row_ptr->fill();
|
||||
pain.text( tmpx, y_offset + row_ptr->baseline(), tmpstring, font);
|
||||
break;
|
||||
@ -3855,10 +3885,10 @@ int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x,
|
||||
vc = last + 1;
|
||||
|
||||
boundary = false;
|
||||
bool lastrow = lyxrc.rtl_support // This is not needed, but gives
|
||||
bool const lastrow = lyxrc.rtl_support // This is not needed, but gives
|
||||
// some speedup if rtl_support=false
|
||||
&& (!row->next() || row->next()->par() != row->par());
|
||||
bool rtl = (lastrow)
|
||||
bool const rtl = (lastrow)
|
||||
? row->par()->isRightToLeftPar(bview->buffer()->params)
|
||||
: false; // If lastrow is false, we don't need to compute
|
||||
// the value of rtl.
|
||||
@ -3875,7 +3905,7 @@ int LyXText::GetColumnNearX(BufferView * bview, Row * row, int & x,
|
||||
++c;
|
||||
} else {
|
||||
c = vis2log(vc - 1);
|
||||
bool rtl = (bidi_level(c) % 2 == 1);
|
||||
bool const rtl = (bidi_level(c) % 2 == 1);
|
||||
if (left_side == rtl) {
|
||||
++c;
|
||||
boundary = IsBoundary(bview->buffer(), row->par(), c);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Version and release date definition */
|
||||
///
|
||||
#define LYX_VERSION "1.1.6cvs"
|
||||
#define LYX_VERSION "1.1.6"
|
||||
///
|
||||
#define LYX_RELEASE "Thu, Oct 26, 2000"
|
||||
/* This version string is intended to be used in files created by LyX */
|
||||
|
Loading…
Reference in New Issue
Block a user