mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
Color patch from Angus, KDE patch from Johnm menu patch from Rob, and the usual uninteresting tweaks from me.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1211 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dacb5be646
commit
0c978e6a3f
75
ChangeLog
75
ChangeLog
@ -1,3 +1,76 @@
|
||||
2000-11-10 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/frontends/xforms/Color.C: include <algorithm> and <cmath>
|
||||
headers.
|
||||
|
||||
* lib/Makefile.am (DOCINST): do not install everything in the
|
||||
documentation directory.
|
||||
|
||||
2000-11-10 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* src/bufferlist.C (newFile): set the filename to the constructed
|
||||
newfileXX.lyx
|
||||
|
||||
* src/lyx_cb.C (MenuWriteAs): if a buffer is "unnamed", pass the
|
||||
constructed "newfileXX.lyx" name to the dialog
|
||||
|
||||
* src/frontends/DialogBase.h: make update() non-abstract so
|
||||
KDE doesn't need to implement two update methods for every form
|
||||
|
||||
* src/frontends/kde/Makefile.am: add missing xforms objects
|
||||
to compile again
|
||||
|
||||
* src/frontends/kde/Dialogs.C: Add FormTabularCreate dialog
|
||||
|
||||
2000-11-09 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/frontends/xforms/Color.[Ch]: new files, defining the color
|
||||
structs RGB and HSV. May not be the best place for these files.
|
||||
Perhaps move them into src ?
|
||||
|
||||
* src/frontends/xforms/Makefile.am: added new files.
|
||||
|
||||
* src/frontends/xforms/forms/form_preferences.fd:
|
||||
* src/frontends/xforms/FormPreferences.[Ch]: bowed to reality and
|
||||
replaced all instances of "colour" with "color"!
|
||||
|
||||
* src/frontends/xforms/forms/form_preferences.fd: modified Colors tab
|
||||
slightly yet again.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.[Ch]: functioning Colors
|
||||
tab. Can now alter the colors of the xform's GUI on the fly. With
|
||||
the aid of a single static Signal (see below), can "Apply" these
|
||||
changes to all currently open dialogs. (Well, to all of the NEW
|
||||
dialogs and to LyXView. The OLD dialogs are not yet redrawn.) ALL
|
||||
subsequently opened dialogs will, of course, also have the new
|
||||
color scheme. Cannot yet save (or load) the choices to file, so
|
||||
they are lost when exiting LyX.
|
||||
|
||||
* src/frontends/Dialogs.h:
|
||||
* src/frontends/xforms/Dialogs.C (redrawGUI): new static Signal.
|
||||
Used to trigger a redraw of any dialogs connected to it because,
|
||||
for example, the GUI colours have been re-mapped.
|
||||
|
||||
* src/frontends/xforms/FormBase.[Ch]:
|
||||
* src/frontends/xforms/FormDocument.[Ch]:
|
||||
* src/frontends/xforms/FormParagraph.[Ch]:
|
||||
* src/frontends/xforms/FormPreferences.[Ch]:
|
||||
* src/frontends/xforms/FormTabular.[Ch]: (redraw): new virtual
|
||||
method, to be connected to Dialogs::redrawGUI. Method must be
|
||||
virtual, because dialogs with tabbed folders need to redraw the
|
||||
forms of each tab folder.
|
||||
|
||||
* src/LyXView.C (d-tor):
|
||||
* src/frontends/xforms/FormBase.C (d-tor): connected
|
||||
Dialogs::redrawGUI signal to redraw().
|
||||
|
||||
* src/frontends/xforms/FormBase.C (~FormBaseBI, ~FormBaseBD):
|
||||
removed Assert, because it is identical to that in FormBase.
|
||||
|
||||
2000-11-10 Rob Lahaye <lahaye@postech.edu>
|
||||
|
||||
* lib/ui/default.ui: minor polishing.
|
||||
|
||||
2000-11-10 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* src/insets/insettext.C (resizeLyXText): check !cache[bv]
|
||||
@ -135,8 +208,6 @@
|
||||
(form_formats): added a "Shortcut" input field. Note that we can't use
|
||||
names such as "input_shortcut" as this buggers up the sed script stuff.
|
||||
|
||||
* src/frontends/xforms/FormPreferences.C
|
||||
|
||||
2000-11-07 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* src/LaTeXLog.C:
|
||||
|
@ -9,7 +9,7 @@ bin_SCRIPTS = listerrors
|
||||
BIND = bind/*.bind
|
||||
CLIPART = clipart/*.eps
|
||||
DOCDIST = doc/LyXConfig.lyx*
|
||||
DOCINST = doc/*
|
||||
DOCINST = doc/*.lyx doc/*.eps doc/*.lyx.in
|
||||
EXAMPLES = examples/*.lyx
|
||||
IMAGES = images/*.xpm
|
||||
KBD = kbd/*.kmap kbd/*.cdef
|
||||
|
@ -107,12 +107,13 @@ Menuset
|
||||
Separator
|
||||
Item "Find & Replace...|F" "find-replace"
|
||||
Separator
|
||||
Submenu "Floats & Insets|I" "edit_floats"
|
||||
Submenu "Tabular|T" "edit_tabular"
|
||||
Submenu "Floats & Insets|I" "edit_floats"
|
||||
Item "Spellchecker...|S" "spellchecker"
|
||||
Item "Check TeX|h" "buffer-chktex"
|
||||
Item "Remove all Error boxes|E" "error-remove-all"
|
||||
Separator
|
||||
Item "Preferences...|e" "dialog-preferences"
|
||||
Item "Preferences...|n" "dialog-preferences"
|
||||
Item "Reconfigure|g" "reconfigure"
|
||||
End
|
||||
|
||||
@ -124,12 +125,10 @@ Menuset
|
||||
Menu "edit_floats"
|
||||
Item "Open/Close|O" "open-stuff"
|
||||
Item "Melt|M" "melt"
|
||||
Item "Open All Footnotes/Margin Notes|A" "floats-operate openfoot"
|
||||
Item "Close All Footnotes/Margin Notes|C" "floats-operate closefoot"
|
||||
Item "Open All Figures/Tables|F" "floats-operate openfig"
|
||||
Item "Close All Figures/Tables|T" "floats-operate closefig"
|
||||
Separator
|
||||
Item "Remove all Error Boxes|R" "error-remove-all"
|
||||
Item "Open All Footnotes/Margin Notes|A" "floats-operate openfoot"
|
||||
Item "Close All Footnotes/Margin Notes|C" "floats-operate closefoot"
|
||||
End
|
||||
|
||||
Menu "edit_tabular"
|
||||
@ -160,8 +159,8 @@ Menuset
|
||||
#
|
||||
Menu "insert"
|
||||
Item "Math text|M" "math-mode"
|
||||
Item "Math Display|D" "math-display"
|
||||
Item "Math Panel...|P" "math-panel"
|
||||
Item "Math display|d" "math-display"
|
||||
Item "Math panel...|p" "math-panel"
|
||||
Separator
|
||||
Submenu "Special character|S" "insert_special"
|
||||
Item "Citation reference...|C" "citation-insert"
|
||||
@ -182,8 +181,8 @@ Menuset
|
||||
End
|
||||
|
||||
Menu "insert_special"
|
||||
Item "Subscript|S" "math-insert _"
|
||||
Item "Superscript|u" "math-insert ^"
|
||||
Item "Superscript|S" "command-sequence math-insert ^;math-mode;"
|
||||
Item "Subscript|u" "command-sequence math-insert _;math-mode;"
|
||||
Item "HFill|H" "hfill-insert"
|
||||
Item "Hyphenation point|p" "hyphenation-point-insert"
|
||||
Item "Protected blank|b" "protected-space-insert"
|
||||
@ -264,6 +263,9 @@ Menuset
|
||||
Documents
|
||||
End
|
||||
|
||||
#
|
||||
# HELP MENU
|
||||
#
|
||||
Menu "help"
|
||||
Item "Introduction|I" "help-open Intro"
|
||||
Item "Tutorial|T" "help-open Tutorial"
|
||||
|
@ -11,7 +11,6 @@ src/credits.C
|
||||
src/credits_form.C
|
||||
src/CutAndPaste.C
|
||||
src/exporter.C
|
||||
src/ext_l10n.h
|
||||
src/filedlg.C
|
||||
src/FontLoader.C
|
||||
src/form1.C
|
||||
|
@ -74,6 +74,7 @@ LyXView::LyXView(int width, int height)
|
||||
.connect(slot(&updateAllVisibleBufferRelatedDialogs));
|
||||
dialogs_->hideBufferDependent
|
||||
.connect(slot(&CloseAllBufferRelatedDialogs));
|
||||
Dialogs::redrawGUI.connect(slot(this, &LyXView::redraw));
|
||||
}
|
||||
|
||||
|
||||
|
@ -456,10 +456,11 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
|
||||
b->paragraph = new LyXParagraph;
|
||||
}
|
||||
|
||||
if (!lyxrc.new_ask_filename) {
|
||||
if (!isNamed)
|
||||
b->setUnnamed();
|
||||
if (!lyxrc.new_ask_filename && !isNamed) {
|
||||
b->setUnnamed();
|
||||
b->setFileName(name);
|
||||
}
|
||||
|
||||
b->setReadonly(false);
|
||||
|
||||
return b;
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
///
|
||||
virtual void hide() = 0;
|
||||
///
|
||||
virtual void update() = 0;
|
||||
virtual void update() {};
|
||||
//@}
|
||||
};
|
||||
|
||||
|
@ -60,6 +60,10 @@ public:
|
||||
~Dialogs();
|
||||
//@}
|
||||
|
||||
/** Redraw all visible popups because, for example, the GUI colours
|
||||
have been re-mapped. */
|
||||
static Signal0<void> redrawGUI;
|
||||
|
||||
/**@name Global Hide and Update Signals */
|
||||
//@{
|
||||
/// Hide all visible popups
|
||||
@ -145,11 +149,3 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "FormPrint.h"
|
||||
#include "FormRef.h"
|
||||
#include "FormTabular.h"
|
||||
#include "FormTabularCreate.h"
|
||||
#include "FormToc.h"
|
||||
#include "FormUrl.h"
|
||||
|
||||
@ -37,6 +38,7 @@ Dialogs::Dialogs(LyXView * lv)
|
||||
dialogs_.push_back(new FormPrint(lv, this));
|
||||
dialogs_.push_back(new FormRef(lv, this));
|
||||
dialogs_.push_back(new FormTabular(lv, this));
|
||||
dialogs_.push_back(new FormTabularCreate(lv, this));
|
||||
dialogs_.push_back(new FormToc(lv, this));
|
||||
dialogs_.push_back(new FormUrl(lv, this));
|
||||
|
||||
|
@ -51,6 +51,10 @@ libkde_la_OBJADD = \
|
||||
../xforms/form_preferences.lo \
|
||||
../xforms/FormTabular.lo \
|
||||
../xforms/form_tabular.lo \
|
||||
../xforms/FormTabularCreate.lo \
|
||||
../xforms/form_tabular_create.lo \
|
||||
../xforms/ButtonController.lo \
|
||||
../xforms/xform_helpers.lo \
|
||||
../xforms/input_validators.lo \
|
||||
../xforms/RadioButtonGroup.lo \
|
||||
../xforms/Toolbar_pimpl.lo \
|
||||
|
130
src/frontends/xforms/Color.C
Normal file
130
src/frontends/xforms/Color.C
Normal file
@ -0,0 +1,130 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include <algorithm> // max
|
||||
#include <cmath> // floor
|
||||
#include "Color.h"
|
||||
|
||||
using std::max;
|
||||
using std::min;
|
||||
|
||||
static int const nohue = -1;
|
||||
|
||||
RGB::RGB( HSV const & hsv )
|
||||
{
|
||||
double h = hsv.h;
|
||||
double s = hsv.s;
|
||||
double v = hsv.v;
|
||||
|
||||
double rd, gd, bd;
|
||||
|
||||
if( h == nohue || s == 0.0 ) {
|
||||
rd = gd = bd = v;
|
||||
} else {
|
||||
if( h == 360.0 ) h = 0.0;
|
||||
h /= 60.0;
|
||||
|
||||
int j = static_cast<int>( ::floor(h) );
|
||||
if( j < 0 ) j = 0;
|
||||
|
||||
double f = h - j;
|
||||
double p = v * (1.0 - s);
|
||||
double q = v * (1.0 - (s*f));
|
||||
double t = v * (1.0 - (s*(1.0 - f)));
|
||||
|
||||
switch( j ) {
|
||||
case 0:
|
||||
rd = v;
|
||||
gd = t;
|
||||
bd = p;
|
||||
break;
|
||||
case 1:
|
||||
rd = q;
|
||||
gd = v;
|
||||
bd = p;
|
||||
break;
|
||||
case 2:
|
||||
rd = p;
|
||||
gd = v;
|
||||
bd = t;
|
||||
break;
|
||||
case 3:
|
||||
rd = p;
|
||||
gd = q;
|
||||
bd = v;
|
||||
break;
|
||||
case 4:
|
||||
rd = t;
|
||||
gd = p;
|
||||
bd = v;
|
||||
break;
|
||||
case 5:
|
||||
rd = v;
|
||||
gd = p;
|
||||
bd = q;
|
||||
break;
|
||||
default:
|
||||
rd = v;
|
||||
gd = t;
|
||||
bd = p;
|
||||
break; // should never happen.
|
||||
}
|
||||
}
|
||||
|
||||
r = static_cast<int>( ::floor((rd * 255.0) + 0.5) );
|
||||
g = static_cast<int>( ::floor((gd * 255.0) + 0.5) );
|
||||
b = static_cast<int>( ::floor((bd * 255.0) + 0.5) );
|
||||
}
|
||||
|
||||
|
||||
HSV::HSV( RGB const & rgb )
|
||||
{
|
||||
// r, g, b lie in the range 0-1, not 0-255.
|
||||
double r = rgb.r / 255.0;
|
||||
double g = rgb.g / 255.0;
|
||||
double b = rgb.b / 255.0;
|
||||
|
||||
double maxval = max( max( r, g ), b );
|
||||
double minval = max( min( r, g ), b );
|
||||
|
||||
v = maxval;
|
||||
|
||||
double diff = maxval - minval;
|
||||
if( maxval != 0.0 )
|
||||
s = diff / maxval;
|
||||
else
|
||||
s = 0.0;
|
||||
|
||||
h = nohue;
|
||||
if( s != 0.0 ) {
|
||||
double rc = (maxval - r) / diff;
|
||||
double gc = (maxval - g) / diff;
|
||||
double bc = (maxval - b) / diff;
|
||||
|
||||
if( r == maxval )
|
||||
h = bc - gc;
|
||||
else if( g == maxval )
|
||||
h = 2.0 + rc - bc;
|
||||
else if( b == maxval )
|
||||
h = 4.0 + gc - rc;
|
||||
|
||||
h *= 60.0;
|
||||
if ( h < 0 )
|
||||
h += 360;
|
||||
}
|
||||
}
|
||||
|
68
src/frontends/xforms/Color.h
Normal file
68
src/frontends/xforms/Color.h
Normal file
@ -0,0 +1,68 @@
|
||||
// -*- C++ -*-
|
||||
/* This file is part of
|
||||
* ======================================================
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-2000 The LyX Team.
|
||||
*
|
||||
*======================================================*/
|
||||
|
||||
#ifndef COLOR_H
|
||||
#define COLOR_H
|
||||
|
||||
#include<utility> // for pair
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
class HSV;
|
||||
class RGB;
|
||||
|
||||
struct HSV {
|
||||
double h;
|
||||
double s;
|
||||
double v;
|
||||
HSV() : h(0.0), s(0.0), v(0.0) {}
|
||||
HSV(double hue, double sat, double val) : h(hue), s(sat), v(val) {}
|
||||
HSV( RGB const & );
|
||||
};
|
||||
|
||||
struct RGB {
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
RGB() : r(0), g(0), b(0) {}
|
||||
RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
|
||||
RGB( HSV const & );
|
||||
};
|
||||
|
||||
typedef std::pair<string, RGB> X11Color;
|
||||
|
||||
/// struct holding xform-specific colors
|
||||
struct XFormColor {
|
||||
string name;
|
||||
int colorID;
|
||||
RGB col;
|
||||
XFormColor() : colorID(0) {}
|
||||
string const getname() { return name; }
|
||||
};
|
||||
|
||||
inline
|
||||
bool operator==(RGB const & c1, RGB const & c2)
|
||||
{
|
||||
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool operator!=(RGB const & c1, RGB const & c2)
|
||||
{
|
||||
return !(c1 == c2);
|
||||
}
|
||||
|
||||
#endif
|
@ -25,6 +25,11 @@
|
||||
extern void ShowCredits();
|
||||
|
||||
|
||||
// Signal enabling all visible popups to be redrawn if so desired.
|
||||
// E.g., when the GUI colours have been remapped.
|
||||
Signal0<void> Dialogs::redrawGUI;
|
||||
|
||||
|
||||
Dialogs::Dialogs(LyXView * lv)
|
||||
{
|
||||
dialogs_.push_back(new FormCitation(lv, this));
|
||||
|
@ -48,6 +48,7 @@ FormBase::FormBase(LyXView * lv, Dialogs * d, string const & t,
|
||||
minw_(0), minh_(0)
|
||||
{
|
||||
Assert(lv && d && bp);
|
||||
Dialogs::redrawGUI.connect(slot(this, &FormBase::redraw));
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +58,13 @@ FormBase::~FormBase()
|
||||
}
|
||||
|
||||
|
||||
void FormBase::redraw()
|
||||
{
|
||||
if( form() && form()->visible )
|
||||
fl_redraw_form( form() );
|
||||
}
|
||||
|
||||
|
||||
void FormBase::connect()
|
||||
{
|
||||
fl_set_form_minsize( form(), minw_, minh_ );
|
||||
@ -166,9 +174,7 @@ FormBaseBI::FormBaseBI(LyXView * lv, Dialogs * d, string const & t,
|
||||
ButtonPolicy * bp,
|
||||
char const * close, char const * cancel)
|
||||
: FormBase( lv, d, t, bp, close, cancel )
|
||||
{
|
||||
Assert(lv && d && bp);
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void FormBaseBI::connect()
|
||||
@ -189,9 +195,7 @@ FormBaseBD::FormBaseBD(LyXView * lv, Dialogs * d, string const & t,
|
||||
char const * close, char const * cancel)
|
||||
: FormBase( lv, d, t, bp, close, cancel ),
|
||||
u_(0)
|
||||
{
|
||||
Assert(lv && d && bp);
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void FormBaseBD::connect()
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include FORMS_H_LOCATION
|
||||
#include "ButtonController.h"
|
||||
#include "gettext.h"
|
||||
#include <sigc++/signal_system.h> // temporary
|
||||
|
||||
class Buffer;
|
||||
class Dialogs;
|
||||
@ -32,6 +33,7 @@ class LyXView;
|
||||
and FormBaseBD.
|
||||
@author Angus Leeming
|
||||
*/
|
||||
|
||||
class FormBase : public DialogBase, public noncopyable {
|
||||
public:
|
||||
/// Callback functions
|
||||
@ -48,14 +50,19 @@ public:
|
||||
static void RestoreCB(FL_OBJECT *, long);
|
||||
|
||||
protected: // methods
|
||||
/** Constructor.
|
||||
#FormBase(lv, d, _("DialogName"), BUFFER_DEPENDENT, new ButtonPolicy)#
|
||||
*/
|
||||
///
|
||||
FormBase(LyXView *, Dialogs *, string const &,
|
||||
ButtonPolicy *, char const *, char const *);
|
||||
///
|
||||
virtual ~FormBase();
|
||||
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
that the xform colours have been re-mapped).
|
||||
Must be virtual because dialogs with tabbed folders will need to
|
||||
redraw the form for each tab.
|
||||
*/
|
||||
virtual void redraw();
|
||||
|
||||
/// Create the dialog if necessary, update it and display it.
|
||||
void show();
|
||||
/// Hide the dialog.
|
||||
|
@ -73,6 +73,19 @@ FormDocument::~FormDocument()
|
||||
}
|
||||
|
||||
|
||||
void FormDocument::redraw()
|
||||
{
|
||||
if( form() && form()->visible )
|
||||
fl_redraw_form( form() );
|
||||
else
|
||||
return;
|
||||
|
||||
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder);
|
||||
if (outer_form && outer_form->visible)
|
||||
fl_redraw_form( outer_form );
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * FormDocument::form() const
|
||||
{
|
||||
if (dialog_) return dialog_->form;
|
||||
|
@ -79,6 +79,9 @@ private:
|
||||
///
|
||||
BULLETBMTABLE
|
||||
};
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
that the xform colours have been re-mapped). */
|
||||
virtual void redraw();
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
/// Filter the inputs
|
||||
|
@ -49,6 +49,19 @@ FormParagraph::~FormParagraph()
|
||||
}
|
||||
|
||||
|
||||
void FormParagraph::redraw()
|
||||
{
|
||||
if( form() && form()->visible )
|
||||
fl_redraw_form( form() );
|
||||
else
|
||||
return;
|
||||
|
||||
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder);
|
||||
if (outer_form && outer_form->visible)
|
||||
fl_redraw_form( outer_form );
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * FormParagraph::form() const
|
||||
{
|
||||
if (dialog_) return dialog_->form;
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
~FormParagraph();
|
||||
|
||||
private:
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
that the xform colours have been re-mapped). */
|
||||
virtual void redraw();
|
||||
/// Build the popup
|
||||
virtual void build();
|
||||
/// Apply from popup
|
||||
|
@ -47,8 +47,9 @@ extern string fmt(char const * fmtstr ...);
|
||||
extern string system_lyxdir;
|
||||
extern Languages languages;
|
||||
|
||||
static string const colourFile("/usr/lib/X11/rgb.txt");
|
||||
vector<FormPreferences::X11Colour> FormPreferences::colourDB;
|
||||
static string const colorFile("/usr/lib/X11/rgb.txt");
|
||||
vector<X11Color> FormPreferences::colorDB;
|
||||
vector<XFormColor> FormPreferences::xformColorDB;
|
||||
pair<vector<string>, vector<string> > FormPreferences::dirlist;
|
||||
|
||||
// Two functions used to help sort a vector<Command> and a vector<Format>.
|
||||
@ -73,7 +74,7 @@ FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
|
||||
dialog_(0),
|
||||
converters_tab_(0), inputs_tab_(0), look_n_feel_tab_(0),
|
||||
outputs_tab_(0), usage_tab_(0),
|
||||
colours_(0), converters_(0), formats_(0), inputs_misc_(0),
|
||||
colors_(0), converters_(0), formats_(0), inputs_misc_(0),
|
||||
interface_(0), language_(0), lnf_misc_(0), outputs_misc_(0),
|
||||
paths_(0), printer_(0), screen_fonts_(0), spellchecker_(0),
|
||||
combo_default_lang(0), combo_kbmap_1(0), combo_kbmap_2(0),
|
||||
@ -92,7 +93,7 @@ FormPreferences::~FormPreferences()
|
||||
delete combo_kbmap_1;
|
||||
delete combo_kbmap_2;
|
||||
|
||||
delete colours_;
|
||||
delete colors_;
|
||||
delete converters_;
|
||||
delete formats_;
|
||||
delete inputs_misc_;
|
||||
@ -115,6 +116,42 @@ FormPreferences::~FormPreferences()
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::redraw()
|
||||
{
|
||||
if( form() && form()->visible )
|
||||
fl_redraw_form( form() );
|
||||
else
|
||||
return;
|
||||
|
||||
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabfolder_prefs);
|
||||
if (outer_form && outer_form->visible)
|
||||
fl_redraw_form( outer_form );
|
||||
else
|
||||
return;
|
||||
|
||||
if( outer_form == converters_tab_->form )
|
||||
outer_form =
|
||||
fl_get_active_folder(converters_tab_->tabfolder_outer);
|
||||
|
||||
else if( outer_form == look_n_feel_tab_->form )
|
||||
outer_form =
|
||||
fl_get_active_folder(look_n_feel_tab_->tabfolder_outer);
|
||||
|
||||
else if( outer_form == inputs_tab_->form )
|
||||
outer_form = fl_get_active_folder(inputs_tab_->tabfolder_outer);
|
||||
|
||||
else if( outer_form == outputs_tab_->form )
|
||||
outer_form =
|
||||
fl_get_active_folder(outputs_tab_->tabfolder_outer);
|
||||
|
||||
else if( outer_form == usage_tab_->form )
|
||||
outer_form = fl_get_active_folder(usage_tab_->tabfolder_outer);
|
||||
|
||||
if (outer_form && outer_form->visible)
|
||||
fl_redraw_form( outer_form );
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * FormPreferences::form() const
|
||||
{
|
||||
if (dialog_) return dialog_->form;
|
||||
@ -166,7 +203,7 @@ void FormPreferences::build()
|
||||
|
||||
// build actual tabfolder contents
|
||||
// these will become nested tabfolders
|
||||
buildColours();
|
||||
buildColors();
|
||||
buildConverters();
|
||||
buildFormats();
|
||||
buildInputsMisc();
|
||||
@ -205,8 +242,8 @@ void FormPreferences::build()
|
||||
_("Interface"),
|
||||
interface_->form);
|
||||
fl_addto_tabfolder(look_n_feel_tab_->tabfolder_outer,
|
||||
_("Colours"),
|
||||
colours_->form);
|
||||
_("Colors"),
|
||||
colors_->form);
|
||||
fl_addto_tabfolder(look_n_feel_tab_->tabfolder_outer,
|
||||
_("Misc"),
|
||||
lnf_misc_->form);
|
||||
@ -258,7 +295,7 @@ void FormPreferences::apply()
|
||||
// like update the screen fonts because that flushes the textcache
|
||||
// and other stuff which may cost us a lot on slower/high-load machines.
|
||||
|
||||
applyColours();
|
||||
applyColors();
|
||||
applyConverters();
|
||||
applyFormats();
|
||||
applyInputsMisc();
|
||||
@ -279,8 +316,8 @@ void FormPreferences::feedback( FL_OBJECT * ob )
|
||||
|
||||
string str;
|
||||
|
||||
if (ob->form->fdui == colours_) {
|
||||
str = feedbackColours( ob );
|
||||
if (ob->form->fdui == colors_) {
|
||||
str = feedbackColors( ob );
|
||||
} else if (ob->form->fdui == converters_) {
|
||||
str = feedbackConverters( ob );
|
||||
} else if (ob->form->fdui == formats_) {
|
||||
@ -321,8 +358,8 @@ bool FormPreferences::input(FL_OBJECT * ob, long)
|
||||
// some totally ridiculous value somewhere. Change activate to suit.
|
||||
// comments before each test describe what is _valid_
|
||||
|
||||
if (ob->form->fdui == colours_)
|
||||
return inputColours(ob);
|
||||
if (ob->form->fdui == colors_)
|
||||
return inputColors(ob);
|
||||
else if (ob->form->fdui == converters_)
|
||||
return inputConverters(ob);
|
||||
else if (ob->form->fdui == language_)
|
||||
@ -336,7 +373,7 @@ bool FormPreferences::input(FL_OBJECT * ob, long)
|
||||
else if (ob->form->fdui == formats_)
|
||||
return inputFormats(ob);
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -345,7 +382,7 @@ void FormPreferences::update()
|
||||
if (!dialog_) return;
|
||||
|
||||
// read lyxrc entries
|
||||
updateColours();
|
||||
updateColors();
|
||||
updateConverters();
|
||||
updateFormats();
|
||||
updateInputsMisc();
|
||||
@ -360,100 +397,291 @@ void FormPreferences::update()
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::applyColours() const
|
||||
void FormPreferences::applyColors() const
|
||||
{
|
||||
bool modifiedXForms = false;
|
||||
bool modifiedText = false;
|
||||
bool modifiedBackground = false;
|
||||
|
||||
for( vector<XFormColor>::const_iterator cit = xformColorDB.begin();
|
||||
cit != xformColorDB.end(); ++cit ) {
|
||||
RGB col;
|
||||
fl_getmcolor((*cit).colorID, &col.r, &col.g, &col.b);
|
||||
if( col != (*cit).col ) {
|
||||
modifiedXForms = true;
|
||||
if( (*cit).colorID == FL_BLACK )
|
||||
modifiedText = true;
|
||||
if( (*cit).colorID == FL_COL1 )
|
||||
modifiedBackground = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( modifiedXForms ) {
|
||||
vector<XFormColor>::const_iterator cit;
|
||||
for( cit = xformColorDB.begin();
|
||||
cit != xformColorDB.end(); ++cit ) {
|
||||
fl_mapcolor((*cit).colorID,
|
||||
(*cit).col.r, (*cit).col.g, (*cit).col.b);
|
||||
|
||||
if( modifiedText && (*cit).colorID == FL_BLACK ) {
|
||||
ColorsAdjustVal( FL_INACTIVE, FL_BLACK, 0.5 );
|
||||
}
|
||||
|
||||
if( modifiedBackground && (*cit).colorID == FL_COL1 ) {
|
||||
ColorsAdjustVal( FL_MCOL, FL_COL1, 0.1 );
|
||||
ColorsAdjustVal( FL_TOP_BCOL, FL_COL1, 0.1 );
|
||||
ColorsAdjustVal( FL_LEFT_BCOL, FL_COL1, 0.1 );
|
||||
|
||||
ColorsAdjustVal( FL_RIGHT_BCOL, FL_COL1, -0.5);
|
||||
ColorsAdjustVal( FL_BOTTOM_BCOL, FL_COL1, -0.5);
|
||||
}
|
||||
}
|
||||
Dialogs::redrawGUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::buildColours()
|
||||
void FormPreferences::buildColors()
|
||||
{
|
||||
colours_ = build_colours();
|
||||
colors_ = build_colors();
|
||||
|
||||
FL_OBJECT * obj = colours_->valslider_red;
|
||||
FL_OBJECT * obj = colors_->valslider_red;
|
||||
fl_set_slider_bounds(obj, 0, 255);
|
||||
fl_set_slider_precision(obj, 0);
|
||||
fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
|
||||
|
||||
obj = colours_->valslider_green;
|
||||
obj = colors_->valslider_green;
|
||||
fl_set_slider_bounds(obj, 0, 255);
|
||||
fl_set_slider_precision(obj, 0);
|
||||
fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
|
||||
|
||||
obj = colours_->valslider_blue;
|
||||
obj = colors_->valslider_blue;
|
||||
fl_set_slider_bounds(obj, 0, 255);
|
||||
fl_set_slider_precision(obj, 0);
|
||||
fl_set_slider_return(obj, FL_RETURN_END_CHANGED);
|
||||
|
||||
fl_set_object_color(colours_->button_colour,
|
||||
fl_set_object_color(colors_->button_color,
|
||||
FL_FREE_COL4, FL_FREE_COL4);
|
||||
|
||||
fl_set_input_return(colours_->input_name, FL_RETURN_END_CHANGED);
|
||||
fl_set_input_return(colors_->input_name, FL_RETURN_END_CHANGED);
|
||||
|
||||
if (ColoursLoadBrowser(colourFile) )
|
||||
fl_set_input(colours_->input_name, colourFile.c_str());
|
||||
if (ColorsLoadBrowserX11(colorFile) )
|
||||
fl_set_input(colors_->input_name, colorFile.c_str());
|
||||
else
|
||||
fl_set_input(colours_->input_name, N_("No file found"));
|
||||
fl_set_input(colors_->input_name, N_("No file found"));
|
||||
|
||||
ColorsLoadBrowserLyX();
|
||||
|
||||
// deactivate the browse button because it isn't implemented
|
||||
fl_deactivate_object(colours_->button_browse);
|
||||
fl_set_object_lcol(colours_->button_browse, FL_INACTIVE);
|
||||
fl_deactivate_object(colors_->button_browse);
|
||||
fl_set_object_lcol(colors_->button_browse, FL_INACTIVE);
|
||||
|
||||
// set up the feedback mechanism
|
||||
setPreHandler( colours_->browser_x11 );
|
||||
setPreHandler( colours_->input_name );
|
||||
setPreHandler( colours_->button_browse );
|
||||
setPreHandler( colours_->button_colour );
|
||||
setPreHandler( colours_->valslider_red );
|
||||
setPreHandler( colours_->valslider_green );
|
||||
setPreHandler( colours_->valslider_blue );
|
||||
setPreHandler( colours_->browser_lyx_objs );
|
||||
setPreHandler( colours_->button_modify );
|
||||
setPreHandler( colors_->browser_x11 );
|
||||
setPreHandler( colors_->input_name );
|
||||
setPreHandler( colors_->button_browse );
|
||||
setPreHandler( colors_->button_color );
|
||||
setPreHandler( colors_->valslider_red );
|
||||
setPreHandler( colors_->valslider_green );
|
||||
setPreHandler( colors_->valslider_blue );
|
||||
setPreHandler( colors_->browser_lyx_objs );
|
||||
setPreHandler( colors_->button_modify );
|
||||
}
|
||||
|
||||
|
||||
string const
|
||||
FormPreferences::feedbackColours(FL_OBJECT const * const ob) const
|
||||
FormPreferences::feedbackColors(FL_OBJECT const * const ob) const
|
||||
{
|
||||
return string();
|
||||
}
|
||||
string str;
|
||||
|
||||
|
||||
bool FormPreferences::inputColours( FL_OBJECT const * const ob )
|
||||
{
|
||||
bool activate = true;
|
||||
|
||||
if (ob == colours_->browser_x11) {
|
||||
int i = fl_get_browser(colours_->browser_x11);
|
||||
if (i > 0) {
|
||||
ColoursUpdateBrowser(i-1);
|
||||
}
|
||||
|
||||
} else if (ob == colours_->valslider_red
|
||||
|| ob == colours_->valslider_green
|
||||
|| ob == colours_->valslider_blue) {
|
||||
ColoursUpdateRGB();
|
||||
|
||||
} else if (ob == colours_->input_name) {
|
||||
string file = fl_get_input(colours_->input_name);
|
||||
if (ColoursLoadBrowser(file) )
|
||||
fl_set_input(colours_->input_name, file.c_str());
|
||||
else if (ColoursLoadBrowser(colourFile) )
|
||||
fl_set_input(colours_->input_name, colourFile.c_str());
|
||||
else
|
||||
fl_set_input(colours_->input_name, N_("No file found"));
|
||||
if (ob == colors_->browser_x11 ) {
|
||||
str = N_("The colors listed in the X11 database.");
|
||||
} else if (ob == colors_->browser_lyx_objs ) {
|
||||
str = N_("LyX objects that can be assigned a color.");
|
||||
} else if (ob == colors_->input_name ) {
|
||||
str = N_("The file containing the X11 color database.");
|
||||
} else if (ob == colors_->button_color ) {
|
||||
str = N_("You will only be able to modify the LyX object if the sliders and X11 browser agree. Force this by clicking on the highlighted browser name.");
|
||||
} else if (ob == colors_->valslider_red
|
||||
|| ob == colors_->valslider_green
|
||||
|| ob == colors_->valslider_blue ) {
|
||||
str = N_("Find a new color. The name highlighted in the X11 database is the closest match to this.");
|
||||
} else if (ob == colors_->button_modify ) {
|
||||
str = N_("Modify the color of the LyX object.");
|
||||
}
|
||||
|
||||
return activate;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::ColoursLoadBrowser(string const & filename)
|
||||
bool FormPreferences::inputColors( FL_OBJECT const * const ob )
|
||||
{
|
||||
if (ob == colors_->browser_x11) {
|
||||
return ColorsBrowserX11();
|
||||
|
||||
} else if (ob == colors_->valslider_red
|
||||
|| ob == colors_->valslider_green
|
||||
|| ob == colors_->valslider_blue) {
|
||||
return ColorsRGB();
|
||||
|
||||
} else if (ob == colors_->input_name) {
|
||||
return ColorsDatabase();
|
||||
|
||||
} else if (ob == colors_->browser_lyx_objs) {
|
||||
return ColorsBrowserLyX();
|
||||
|
||||
} else if (ob == colors_->button_modify) {
|
||||
return ColorsModify();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::ColorsAdjustVal( int colAdjust, int colParent,
|
||||
double addVal ) const
|
||||
{
|
||||
RGB rgb;
|
||||
fl_getmcolor( colParent, &rgb.r, &rgb.g, &rgb.b);
|
||||
|
||||
HSV hsv = HSV( rgb );
|
||||
hsv.v += addVal;
|
||||
if( hsv.v > 1.0 )
|
||||
hsv.v = 1.0;
|
||||
else if( hsv.v < 0.0 )
|
||||
hsv.v = 0.0;
|
||||
|
||||
rgb = RGB( hsv );
|
||||
fl_mapcolor( colAdjust, rgb.r, rgb.g, rgb.b );
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::ColorsBrowserLyX() const
|
||||
{
|
||||
int i = fl_get_browser( colors_->browser_lyx_objs );
|
||||
if (i < 1)
|
||||
return true;
|
||||
|
||||
string name = fl_get_browser_line( colors_->browser_lyx_objs, i );
|
||||
|
||||
vector<XFormColor>::const_iterator cit =
|
||||
find_if(xformColorDB.begin(), xformColorDB.end(),
|
||||
compare_memfun(&XFormColor::getname, name));
|
||||
|
||||
if( cit != xformColorDB.end() ) {
|
||||
fl_freeze_form( colors_->form );
|
||||
|
||||
fl_set_slider_value( colors_->valslider_red, (*cit).col.r );
|
||||
fl_set_slider_value( colors_->valslider_green, (*cit).col.g );
|
||||
fl_set_slider_value( colors_->valslider_blue, (*cit).col.b );
|
||||
ColorsRGB();
|
||||
|
||||
fl_unfreeze_form( colors_->form );
|
||||
}
|
||||
|
||||
fl_deactivate_object( colors_->button_modify );
|
||||
fl_set_object_lcol( colors_->button_modify, FL_INACTIVE );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::ColorsBrowserX11() const
|
||||
{
|
||||
int i = fl_get_browser(colors_->browser_x11);
|
||||
if (i < 1)
|
||||
return true;
|
||||
|
||||
fl_freeze_form( colors_->form );
|
||||
|
||||
RGB col = colorDB[i-1].second;
|
||||
|
||||
fl_mapcolor( FL_FREE_COL4 + i, col.r, col.g, col.b );
|
||||
fl_mapcolor( FL_FREE_COL4, col.r, col.g, col.b );
|
||||
fl_set_slider_value( colors_->valslider_red, col.r );
|
||||
fl_set_slider_value( colors_->valslider_green, col.g );
|
||||
fl_set_slider_value( colors_->valslider_blue, col.b );
|
||||
fl_redraw_object( colors_->button_color );
|
||||
|
||||
// Is it valid to activate the "Modify" button?
|
||||
int line = fl_get_browser(colors_->browser_lyx_objs);
|
||||
bool isSelected = ( line > 0 );
|
||||
if( isSelected )
|
||||
if( line > fl_get_browser_maxline(colors_->browser_lyx_objs) )
|
||||
isSelected = false;
|
||||
|
||||
if( isSelected && colorDB[i-1].second == col ) {
|
||||
fl_activate_object( colors_->button_modify );
|
||||
fl_set_object_lcol( colors_->button_modify, FL_BLACK );
|
||||
}
|
||||
|
||||
fl_unfreeze_form( colors_->form );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::ColorsDatabase() const
|
||||
{
|
||||
string file = fl_get_input(colors_->input_name);
|
||||
if (ColorsLoadBrowserX11(file) )
|
||||
fl_set_input(colors_->input_name, file.c_str());
|
||||
else if (ColorsLoadBrowserX11(colorFile) )
|
||||
fl_set_input(colors_->input_name, colorFile.c_str());
|
||||
else
|
||||
fl_set_input(colors_->input_name, N_("No file found"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::ColorsLoadBrowserLyX()
|
||||
{
|
||||
XFormColor xcol;
|
||||
|
||||
xcol.name = "GUI background";
|
||||
xcol.colorID = FL_COL1;
|
||||
fl_getmcolor(FL_COL1, &xcol.col.r, &xcol.col.g, &xcol.col.b);
|
||||
|
||||
xformColorDB.push_back( xcol );
|
||||
|
||||
xcol.name = "GUI text";
|
||||
xcol.colorID = FL_BLACK;
|
||||
fl_getmcolor(FL_BLACK, &xcol.col.r, &xcol.col.g, &xcol.col.b);
|
||||
|
||||
xformColorDB.push_back( xcol );
|
||||
|
||||
xcol.name = "GUI active tab";
|
||||
xcol.colorID = FL_LIGHTER_COL1;
|
||||
fl_getmcolor(FL_LIGHTER_COL1, &xcol.col.r, &xcol.col.g, &xcol.col.b);
|
||||
|
||||
xformColorDB.push_back( xcol );
|
||||
|
||||
xcol.name = "GUI push button";
|
||||
xcol.colorID = FL_YELLOW;
|
||||
fl_getmcolor(FL_YELLOW, &xcol.col.r, &xcol.col.g, &xcol.col.b);
|
||||
|
||||
xformColorDB.push_back( xcol );
|
||||
|
||||
FL_OBJECT * colbr = colors_->browser_lyx_objs;
|
||||
fl_clear_browser( colbr );
|
||||
for( vector<XFormColor>::const_iterator cit = xformColorDB.begin();
|
||||
cit != xformColorDB.end(); ++cit ) {
|
||||
fl_addto_browser(colbr, (*cit).name.c_str() );
|
||||
}
|
||||
|
||||
fl_deselect_browser(colors_->browser_lyx_objs);
|
||||
fl_deactivate_object( colors_->button_modify );
|
||||
fl_set_object_lcol( colors_->button_modify, FL_INACTIVE );
|
||||
}
|
||||
|
||||
|
||||
bool FormPreferences::ColorsLoadBrowserX11(string const & filename) const
|
||||
{
|
||||
LyXLex lex(0, 0);
|
||||
lex.setCommentChar('!');
|
||||
|
||||
if (!lex.setFile(filename))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
vector<RGB> cols;
|
||||
vector<string> names;
|
||||
@ -483,8 +711,8 @@ bool FormPreferences::ColoursLoadBrowser(string const & filename)
|
||||
name = "white";
|
||||
else
|
||||
name = lowercase( name );
|
||||
|
||||
if (name == "black" || name == "white") {
|
||||
|
||||
if ( col == RGB(0,0,0) || col == RGB(255,255,255) ) {
|
||||
cols.insert(cols.begin(), col);
|
||||
names.insert(names.begin(), name);
|
||||
} else {
|
||||
@ -494,41 +722,105 @@ bool FormPreferences::ColoursLoadBrowser(string const & filename)
|
||||
}
|
||||
}
|
||||
|
||||
FL_OBJECT * colbr = colors_->browser_x11;
|
||||
fl_freeze_form(colors_->form);
|
||||
fl_clear_browser( colbr );
|
||||
|
||||
vector<string>::const_iterator sit = names.begin();
|
||||
for (vector<RGB>::const_iterator iit = cols.begin();
|
||||
iit != cols.end(); ++iit, ++sit) {
|
||||
colourDB.push_back( X11Colour(*sit, *iit) );
|
||||
colorDB.push_back( X11Color(*sit, *iit) );
|
||||
fl_addto_browser(colbr, (*sit).c_str());
|
||||
}
|
||||
|
||||
FL_OBJECT * colbr = colours_->browser_x11;
|
||||
fl_freeze_form(colours_->form);
|
||||
fl_clear_browser( colbr );
|
||||
|
||||
for (vector<X11Colour>::const_iterator cit = colourDB.begin();
|
||||
cit != colourDB.end(); ++cit) {
|
||||
string name = (*cit).first;
|
||||
//RGB col = (*cit).second;
|
||||
//name += " (" + tostr(col.r) + ", " + tostr(col.g) +
|
||||
// ", " + tostr(col.b) + ")";
|
||||
fl_addto_browser(colbr, name.c_str());
|
||||
}
|
||||
|
||||
fl_set_browser_topline(colbr, 1);
|
||||
fl_select_browser_line(colbr, 1);
|
||||
ColoursUpdateBrowser(0);
|
||||
fl_unfreeze_form(colours_->form);
|
||||
ColorsBrowserX11();
|
||||
fl_unfreeze_form(colors_->form);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int FormPreferences::ColoursSearchEntry(RGB const & col) const
|
||||
bool FormPreferences::ColorsModify() const
|
||||
{
|
||||
int i = fl_get_browser( colors_->browser_lyx_objs );
|
||||
if (i < 1)
|
||||
return true;
|
||||
|
||||
string name = fl_get_browser_line( colors_->browser_lyx_objs, i );
|
||||
|
||||
vector<XFormColor>::iterator it = // non-const; it's modified below
|
||||
find_if(xformColorDB.begin(), xformColorDB.end(),
|
||||
compare_memfun(&XFormColor::getname, name));
|
||||
|
||||
if( it == xformColorDB.end() )
|
||||
return true;
|
||||
|
||||
int j = fl_get_browser( colors_->browser_x11 );
|
||||
if (j < 1)
|
||||
return true;
|
||||
|
||||
(*it).col.r = colorDB[j-1].second.r;
|
||||
(*it).col.g = colorDB[j-1].second.g;
|
||||
(*it).col.b = colorDB[j-1].second.b;
|
||||
|
||||
fl_deselect_browser(colors_->browser_x11);
|
||||
fl_deselect_browser(colors_->browser_lyx_objs);
|
||||
fl_deactivate_object( colors_->button_modify );
|
||||
fl_set_object_lcol( colors_->button_modify, FL_INACTIVE );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FormPreferences::ColorsRGB() const
|
||||
{
|
||||
fl_freeze_form(colors_->form);
|
||||
|
||||
RGB col;
|
||||
col.r = int(fl_get_slider_value(colors_->valslider_red));
|
||||
col.g = int(fl_get_slider_value(colors_->valslider_green));
|
||||
col.b = int(fl_get_slider_value(colors_->valslider_blue));
|
||||
|
||||
fl_mapcolor(FL_FREE_COL4, col.r, col.g, col.b);
|
||||
fl_redraw_object(colors_->button_color);
|
||||
|
||||
int const i = ColorsSearchEntry( col );
|
||||
// change topline only if necessary
|
||||
// int top = fl_get_browser_topline(colors_->browser_x11);
|
||||
// if (i < top || i > (top+15))
|
||||
fl_set_browser_topline(colors_->browser_x11, i - 5);
|
||||
fl_select_browser_line(colors_->browser_x11, i + 1);
|
||||
|
||||
// Only activate the "Modify" button if the browser and slider colors
|
||||
// are the same AND if a LyX object is selected.
|
||||
int line = fl_get_browser(colors_->browser_lyx_objs);
|
||||
bool isSelected = ( line > 0 );
|
||||
if( isSelected )
|
||||
if( line > fl_get_browser_maxline(colors_->browser_lyx_objs) )
|
||||
isSelected = false;
|
||||
|
||||
if( isSelected && colorDB[i].second == col ) {
|
||||
fl_activate_object( colors_->button_modify );
|
||||
fl_set_object_lcol( colors_->button_modify, FL_BLACK );
|
||||
} else {
|
||||
fl_deactivate_object( colors_->button_modify );
|
||||
fl_set_object_lcol( colors_->button_modify, FL_INACTIVE );
|
||||
}
|
||||
|
||||
fl_unfreeze_form(colors_->form);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int FormPreferences::ColorsSearchEntry(RGB const & col) const
|
||||
{
|
||||
int mindiff = 0x7fffffff;
|
||||
vector<X11Colour>::const_iterator mincit = colourDB.begin();
|
||||
vector<X11Color>::const_iterator mincit = colorDB.begin();
|
||||
|
||||
for (vector<X11Colour>::const_iterator cit = colourDB.begin();
|
||||
cit != colourDB.end(); ++cit) {
|
||||
for (vector<X11Color>::const_iterator cit = colorDB.begin();
|
||||
cit != colorDB.end(); ++cit) {
|
||||
RGB colDB = (*cit).second;
|
||||
RGB diff;
|
||||
diff.r = col.r - colDB.r;
|
||||
@ -544,51 +836,11 @@ int FormPreferences::ColoursSearchEntry(RGB const & col) const
|
||||
mincit = cit;
|
||||
}
|
||||
}
|
||||
return static_cast<int>(mincit - colourDB.begin());
|
||||
return static_cast<int>(mincit - colorDB.begin());
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::ColoursUpdateBrowser(int i)
|
||||
{
|
||||
fl_freeze_form(colours_->form);
|
||||
|
||||
RGB col = colourDB[i].second;
|
||||
|
||||
fl_mapcolor(FL_FREE_COL4 + i, col.r, col.g, col.b);
|
||||
fl_mapcolor(FL_FREE_COL4, col.r, col.g, col.b);
|
||||
fl_set_slider_value(colours_->valslider_red, col.r);
|
||||
fl_set_slider_value(colours_->valslider_green, col.g);
|
||||
fl_set_slider_value(colours_->valslider_blue, col.b);
|
||||
fl_redraw_object(colours_->button_colour);
|
||||
|
||||
fl_unfreeze_form(colours_->form);
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::ColoursUpdateRGB()
|
||||
{
|
||||
fl_freeze_form(colours_->form);
|
||||
|
||||
RGB col;
|
||||
col.r = int(fl_get_slider_value(colours_->valslider_red));
|
||||
col.g = int(fl_get_slider_value(colours_->valslider_green));
|
||||
col.b = int(fl_get_slider_value(colours_->valslider_blue));
|
||||
|
||||
fl_mapcolor(FL_FREE_COL4, col.r, col.g, col.b);
|
||||
fl_redraw_object(colours_->button_colour);
|
||||
|
||||
int const i = ColoursSearchEntry( col );
|
||||
// change topline only if necessary
|
||||
// int top = fl_get_browser_topline(colours_->browser_x11);
|
||||
// if (i < top || i > (top+15))
|
||||
fl_set_browser_topline(colours_->browser_x11, i - 5);
|
||||
fl_select_browser_line(colours_->browser_x11, i + 1);
|
||||
|
||||
fl_unfreeze_form(colours_->form);
|
||||
}
|
||||
|
||||
|
||||
void FormPreferences::updateColours()
|
||||
void FormPreferences::updateColors()
|
||||
{}
|
||||
|
||||
|
||||
@ -685,7 +937,7 @@ bool FormPreferences::inputConverters( FL_OBJECT const * const ob )
|
||||
return ConvertersDelete();
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -708,7 +960,7 @@ bool FormPreferences::ConvertersAdd()
|
||||
string to = command.to->prettyname;
|
||||
pair<string, string> FromTo = pair<string, string>(from, to);
|
||||
|
||||
vector<Command>::iterator it = // non-const because it's modified below
|
||||
vector<Command>::iterator it = // non-const; it's modified below
|
||||
find_if(commands_vec.begin(), commands_vec.end(),
|
||||
compare_memfun(&Command::getFromToPrettyname, FromTo));
|
||||
|
||||
@ -842,7 +1094,7 @@ bool FormPreferences::ConvertersDelete()
|
||||
string to = command.to->prettyname;
|
||||
pair<string, string> FromTo = pair<string, string>(from, to);
|
||||
|
||||
vector<Command>::iterator it = // non-const because it's modified below
|
||||
vector<Command>::iterator it = // non-const; it's modified below
|
||||
find_if(commands_vec.begin(), commands_vec.end(),
|
||||
compare_memfun(&Command::getFromToPrettyname, FromTo));
|
||||
|
||||
@ -1115,7 +1367,7 @@ bool FormPreferences::FormatsAdd()
|
||||
return false;
|
||||
|
||||
Format format(name, extension, prettyname, shortcut, viewer);
|
||||
vector<Format>::iterator it = // non-const because it's modified below
|
||||
vector<Format>::iterator it = // non-const; it's modified below
|
||||
find_if(formats_vec.begin(), formats_vec.end(),
|
||||
compare_memfun(&Format::getname, name));
|
||||
|
||||
@ -1212,7 +1464,7 @@ void FormPreferences::FormatsClear() const
|
||||
bool FormPreferences::FormatsDelete()
|
||||
{
|
||||
string name = fl_get_input(formats_->input_format);
|
||||
vector<Format>::iterator it = // non-const because it's modified below
|
||||
vector<Format>::iterator it = // non-const; it's modified below
|
||||
find_if(formats_vec.begin(), formats_vec.end(),
|
||||
compare_memfun(&Format::getname, name));
|
||||
|
||||
@ -1621,8 +1873,9 @@ void FormPreferences::updateLanguage()
|
||||
find( dirlist.first.begin(), dirlist.first.end(),
|
||||
fullpath );
|
||||
if (cit != dirlist.first.end()) {
|
||||
vector<string>::size_type sel = cit - dirlist.first.begin();
|
||||
combo_kbmap_1->select_text( dirlist.second[sel] );
|
||||
vector<string>::size_type sel =
|
||||
cit - dirlist.first.begin();
|
||||
combo_kbmap_1->select_text(dirlist.second[sel]);
|
||||
} else
|
||||
combo_kbmap_1->select_text("");
|
||||
|
||||
@ -1630,10 +1883,11 @@ void FormPreferences::updateLanguage()
|
||||
cit = find( dirlist.first.begin(), dirlist.first.end(),
|
||||
fullpath );
|
||||
if (cit != dirlist.first.end()) {
|
||||
vector<string>::size_type sel = cit - dirlist.first.begin();
|
||||
combo_kbmap_2->select_text( dirlist.second[sel] );
|
||||
vector<string>::size_type sel =
|
||||
cit - dirlist.first.begin();
|
||||
combo_kbmap_2->select_text(dirlist.second[sel]);
|
||||
} else
|
||||
combo_kbmap_1->select_text("");
|
||||
combo_kbmap_2->select_text("");
|
||||
} else {
|
||||
combo_kbmap_1->select_text( "" );
|
||||
combo_kbmap_2->select_text( "" );
|
||||
|
@ -17,7 +17,10 @@
|
||||
#ifndef FORMPREFERENCES_H
|
||||
#define FORMPREFERENCES_H
|
||||
|
||||
#include <utility> // for pair
|
||||
|
||||
#include "FormBase.h"
|
||||
#include "Color.h"
|
||||
|
||||
#ifdef __GNUG_
|
||||
#pragma interface
|
||||
@ -28,7 +31,7 @@ class Command;
|
||||
class Dialogs;
|
||||
class Format;
|
||||
class LyXView;
|
||||
struct FD_form_colours;
|
||||
struct FD_form_colors;
|
||||
struct FD_form_converters;
|
||||
struct FD_form_formats;
|
||||
struct FD_form_inputs_misc;
|
||||
@ -59,21 +62,9 @@ public:
|
||||
FL_Coord, FL_Coord, int, void *);
|
||||
|
||||
private:
|
||||
/// helper struct for Colours
|
||||
struct RGB {
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
RGB() : r(0), g(0), b(0) {}
|
||||
RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
|
||||
};
|
||||
///
|
||||
friend bool operator==(RGB const &, RGB const &);
|
||||
///
|
||||
friend bool operator!=(RGB const &, RGB const &);
|
||||
///
|
||||
typedef std::pair<string, RGB> X11Colour;
|
||||
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
that the xform colours have been re-mapped). */
|
||||
virtual void redraw();
|
||||
/// Update the dialog.
|
||||
virtual void update();
|
||||
///
|
||||
@ -97,7 +88,7 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
void applyColours() const;
|
||||
void applyColors() const;
|
||||
///
|
||||
void applyConverters() const;
|
||||
///
|
||||
@ -125,7 +116,7 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
void buildColours();
|
||||
void buildColors();
|
||||
///
|
||||
void buildConverters();
|
||||
///
|
||||
@ -153,7 +144,7 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
string const feedbackColours(FL_OBJECT const * const) const;
|
||||
string const feedbackColors(FL_OBJECT const * const) const;
|
||||
///
|
||||
string const feedbackConverters(FL_OBJECT const * const) const;
|
||||
///
|
||||
@ -181,7 +172,7 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
bool inputColours(FL_OBJECT const * const);
|
||||
bool inputColors(FL_OBJECT const * const);
|
||||
///
|
||||
bool inputConverters( FL_OBJECT const * const );
|
||||
///
|
||||
@ -199,7 +190,7 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
void updateColours();
|
||||
void updateColors();
|
||||
///
|
||||
void updateConverters();
|
||||
///
|
||||
@ -227,13 +218,23 @@ private:
|
||||
*/
|
||||
|
||||
///
|
||||
bool ColoursLoadBrowser( string const & );
|
||||
void ColorsAdjustVal( int, int, double ) const;
|
||||
///
|
||||
int ColoursSearchEntry(RGB const & ) const;
|
||||
bool ColorsBrowserLyX() const;
|
||||
///
|
||||
void ColoursUpdateBrowser( int );
|
||||
bool ColorsBrowserX11() const;
|
||||
///
|
||||
void ColoursUpdateRGB();
|
||||
bool ColorsDatabase() const;
|
||||
///
|
||||
void ColorsLoadBrowserLyX();
|
||||
///
|
||||
bool ColorsLoadBrowserX11(string const &) const;
|
||||
///
|
||||
bool ColorsModify() const;
|
||||
///
|
||||
bool ColorsRGB() const;
|
||||
///
|
||||
int ColorsSearchEntry(RGB const &) const;
|
||||
|
||||
///
|
||||
bool ConvertersAdd();
|
||||
@ -279,7 +280,7 @@ private:
|
||||
///
|
||||
FD_form_outer_tab * build_outer_tab();
|
||||
///
|
||||
FD_form_colours * build_colours();
|
||||
FD_form_colors * build_colors();
|
||||
///
|
||||
FD_form_converters * build_converters();
|
||||
///
|
||||
@ -316,7 +317,7 @@ private:
|
||||
/// Spellchecker, language stuff, etc
|
||||
FD_form_outer_tab * usage_tab_;
|
||||
///
|
||||
FD_form_colours * colours_;
|
||||
FD_form_colors * colors_;
|
||||
///
|
||||
FD_form_converters * converters_;
|
||||
///
|
||||
@ -350,8 +351,10 @@ private:
|
||||
std::vector<Format> formats_vec;
|
||||
/// A vector of Commands, to be manipulated in the Converter browser.
|
||||
std::vector<Command> commands_vec;
|
||||
/// A vector of RGB colours and associated name.
|
||||
static std::vector<X11Colour> colourDB;
|
||||
/// A vector of RGB colors and associated name.
|
||||
static std::vector<X11Color> colorDB;
|
||||
/// A vector of xform RGB colors and associated name.
|
||||
static std::vector<XFormColor> xformColorDB;
|
||||
/** A collection of kmap files.
|
||||
First entry is the file name, full path.
|
||||
Second entry is the shorthand, as appears in the fl_choice.
|
||||
@ -362,19 +365,4 @@ private:
|
||||
bool warningPosted;
|
||||
};
|
||||
|
||||
inline
|
||||
bool operator==(FormPreferences::RGB const & c1,
|
||||
FormPreferences::RGB const & c2)
|
||||
{
|
||||
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
bool operator!=(FormPreferences::RGB const & c1,
|
||||
FormPreferences::RGB const & c2)
|
||||
{
|
||||
return !(c1 == c2);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -46,6 +46,19 @@ FormTabular::~FormTabular()
|
||||
}
|
||||
|
||||
|
||||
void FormTabular::redraw()
|
||||
{
|
||||
if( form() && form()->visible )
|
||||
fl_redraw_form( form() );
|
||||
else
|
||||
return;
|
||||
|
||||
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabFolder);
|
||||
if (outer_form && outer_form->visible)
|
||||
fl_redraw_form( outer_form );
|
||||
}
|
||||
|
||||
|
||||
FL_FORM * FormTabular::form() const
|
||||
{
|
||||
if (dialog_ ) return dialog_->form;
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
~FormTabular();
|
||||
|
||||
private:
|
||||
/** Redraw the form (on receipt of a Signal indicating, for example,
|
||||
that the xform colours have been re-mapped). */
|
||||
virtual void redraw();
|
||||
/// Disconnect signals. Also perform any necessary housekeeping.
|
||||
virtual void disconnect();
|
||||
|
||||
|
@ -14,6 +14,8 @@ ETAGS_ARGS = --lang=c++
|
||||
libxforms_la_SOURCES = \
|
||||
ButtonController.C \
|
||||
ButtonController.h \
|
||||
Color.C \
|
||||
Color.h \
|
||||
Dialogs.C \
|
||||
GUIRunTime.C \
|
||||
FormBase.C \
|
||||
|
@ -381,23 +381,23 @@ FD_form_language * FormPreferences::build_language()
|
||||
}
|
||||
/*---------------------------------------*/
|
||||
|
||||
FD_form_colours::~FD_form_colours()
|
||||
FD_form_colors::~FD_form_colors()
|
||||
{
|
||||
if ( form->visible ) fl_hide_form( form );
|
||||
fl_free_form( form );
|
||||
}
|
||||
|
||||
|
||||
FD_form_colours * FormPreferences::build_colours()
|
||||
FD_form_colors * FormPreferences::build_colors()
|
||||
{
|
||||
FL_OBJECT *obj;
|
||||
FD_form_colours *fdui = new FD_form_colours;
|
||||
FD_form_colors *fdui = new FD_form_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 colour names|#X")));
|
||||
fl_set_button_shortcut(obj, scex(_("X11 colour names|#X")), 1);
|
||||
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);
|
||||
@ -410,7 +410,7 @@ FD_form_colours * FormPreferences::build_colours()
|
||||
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_colour = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 230, 90, 30, "");
|
||||
fdui->button_color = obj = fl_add_button(FL_NORMAL_BUTTON, 180, 230, 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")));
|
||||
@ -431,12 +431,12 @@ FD_form_colours * FormPreferences::build_colours()
|
||||
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, 200, idex(_("LyX objects|#L")));
|
||||
fdui->browser_lyx_objs = obj = fl_add_browser(FL_HOLD_BROWSER, 290, 25, 150, 251, 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, 350, 230, 90, 30, idex(_("Modify|#M")));
|
||||
fdui->button_modify = obj = fl_add_button(FL_NORMAL_BUTTON, 320, 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);
|
||||
|
@ -123,14 +123,14 @@ struct FD_form_language {
|
||||
FL_OBJECT *input_command_begin;
|
||||
FL_OBJECT *input_command_end;
|
||||
};
|
||||
struct FD_form_colours {
|
||||
~FD_form_colours();
|
||||
struct FD_form_colors {
|
||||
~FD_form_colors();
|
||||
|
||||
FL_FORM *form;
|
||||
FL_OBJECT *browser_x11;
|
||||
FL_OBJECT *input_name;
|
||||
FL_OBJECT *button_browse;
|
||||
FL_OBJECT *button_colour;
|
||||
FL_OBJECT *button_color;
|
||||
FL_OBJECT *valslider_red;
|
||||
FL_OBJECT *valslider_green;
|
||||
FL_OBJECT *valslider_blue;
|
||||
|
@ -1143,7 +1143,7 @@ callback: C_FormBaseInputCB
|
||||
argument: 0
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_colours
|
||||
Name: form_colors
|
||||
Width: 450
|
||||
Height: 360
|
||||
Number of Objects: 10
|
||||
@ -1176,7 +1176,7 @@ alignment: FL_ALIGN_TOP
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: X11 colour names|#X
|
||||
label: X11 color names|#X
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
@ -1234,7 +1234,7 @@ label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: button_colour
|
||||
name: button_color
|
||||
callback:
|
||||
argument:
|
||||
|
||||
@ -1298,7 +1298,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 290 25 150 200
|
||||
box: 290 25 150 251
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_TOP
|
||||
@ -1316,7 +1316,7 @@ argument: 0
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 350 230 90 30
|
||||
box: 320 285 90 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
|
24
src/lyx_cb.C
24
src/lyx_cb.C
@ -218,29 +218,23 @@ bool MenuWriteAs(Buffer * buffer)
|
||||
if (!IsLyXFilename(fname))
|
||||
fname += ".lyx";
|
||||
|
||||
if (buffer->isUnnamed()) {
|
||||
fname = fileDlg.Select(_("Enter Filename to Save Document as"),
|
||||
"",
|
||||
"*.lyx",
|
||||
"");
|
||||
} else {
|
||||
fname = fileDlg.Select(_("Enter Filename to Save Document as"),
|
||||
OnlyPath(fname),
|
||||
"*.lyx",
|
||||
OnlyFilename(fname));
|
||||
}
|
||||
fname = fileDlg.Select(_("Enter Filename to Save Document as"),
|
||||
OnlyPath(fname),
|
||||
"*.lyx",
|
||||
OnlyFilename(fname));
|
||||
|
||||
AllowInput(current_view);
|
||||
|
||||
if (fname.empty()) {
|
||||
if (fname.empty())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure the absolute filename ends with appropriate suffix
|
||||
string s = MakeAbsPath(fname);
|
||||
if (!IsLyXFilename(s))
|
||||
s += ".lyx";
|
||||
|
||||
// Same name as we have already?
|
||||
if (s == oldname) {
|
||||
if (!buffer->isUnnamed() && s == oldname) {
|
||||
if (!AskQuestion(_("Same name as document already has:"),
|
||||
MakeDisplayPath(s, 50),
|
||||
_("Save anyway?")))
|
||||
@ -248,7 +242,7 @@ bool MenuWriteAs(Buffer * buffer)
|
||||
// Falls through to name change and save
|
||||
}
|
||||
// No, but do we have another file with this name open?
|
||||
else if (bufferlist.exists(s)) {
|
||||
else if (!buffer->isUnnamed() && bufferlist.exists(s)) {
|
||||
if (AskQuestion(_("Another document with same name open!"),
|
||||
MakeDisplayPath(s, 50),
|
||||
_("Replace with current document?")))
|
||||
|
Loading…
Reference in New Issue
Block a user