mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
add GTK wrap dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10788 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
37d42d45f3
commit
d07928baf5
@ -1,6 +1,7 @@
|
||||
2006-01-28 John Spray <spray@lyx.org>
|
||||
|
||||
* GtkLengthEntry.[Ch]: implement signal_changed, setup spin limits
|
||||
* GWrap.[Ch], glade/wrap.glade: Add Wrap dialog
|
||||
|
||||
2006-01-27 Bernhard Reiter <ockham@gmx.net>
|
||||
|
||||
|
@ -94,14 +94,13 @@
|
||||
#include "GToc.h"
|
||||
#include "GUrl.h"
|
||||
#include "GVSpace.h"
|
||||
//#include "FormWrap.h"
|
||||
#include "GWrap.h"
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
#include "ControlThesaurus.h"
|
||||
#include "GThesaurus.h"
|
||||
#endif
|
||||
|
||||
//#include "xformsBC.h"
|
||||
#include "ButtonController.h"
|
||||
|
||||
#include "arrows.xbm"
|
||||
@ -561,9 +560,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
dialog->setView(new GVSpace(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "wrap") {
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlWrap(*dialog));
|
||||
// dialog->setView(new FormWrap(*dialog));
|
||||
dialog->setView(new GWrap(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
}
|
||||
|
||||
|
116
src/frontends/gtk/GWrap.C
Normal file
116
src/frontends/gtk/GWrap.C
Normal file
@ -0,0 +1,116 @@
|
||||
/**
|
||||
* \file GWrap.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
// Too hard to make concept checks work with this file
|
||||
#ifdef _GLIBCXX_CONCEPT_CHECKS
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
#endif
|
||||
#ifdef _GLIBCPP_CONCEPT_CHECKS
|
||||
#undef _GLIBCPP_CONCEPT_CHECKS
|
||||
#endif
|
||||
|
||||
#include "GWrap.h"
|
||||
#include "ControlWrap.h"
|
||||
#include "insets/insetwrap.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
GWrap::GWrap(Dialog & parent)
|
||||
: GViewCB<ControlWrap, GViewGladeB>(parent, _("Text Wrap Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GWrap::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("wrap");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
Gtk::Button * cancelbutton;
|
||||
xml_->get_widget("Close", cancelbutton);
|
||||
setCancel(cancelbutton);
|
||||
|
||||
xml_->get_widget_derived ("Width", widthlengthentry_);
|
||||
xml_->get_widget ("Placement", placementcombo_);
|
||||
|
||||
widthlengthentry_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GWrap::apply));
|
||||
placementcombo_->signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GWrap::apply));
|
||||
|
||||
bcview().addReadOnly(widthlengthentry_);
|
||||
bcview().addReadOnly(placementcombo_);
|
||||
}
|
||||
|
||||
|
||||
void GWrap::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
InsetWrapParams & params = controller().params();
|
||||
|
||||
widthlengthentry_->set_length (params.width);
|
||||
|
||||
int item;
|
||||
if (params.placement == "l")
|
||||
item = 1;
|
||||
else if (params.placement == "r")
|
||||
item = 2;
|
||||
else if (params.placement == "p")
|
||||
item = 3;
|
||||
|
||||
placementcombo_->set_active (item);
|
||||
|
||||
bc().refreshReadOnly();
|
||||
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GWrap::apply()
|
||||
{
|
||||
if (applylock_)
|
||||
return;
|
||||
|
||||
InsetWrapParams & params = controller().params();
|
||||
|
||||
params.width = widthlengthentry_->get_length();
|
||||
|
||||
int const placementrow = placementcombo_->get_active_row_number();
|
||||
BOOST_ASSERT (0 <= placementrow <= 3);
|
||||
switch (placementrow) {
|
||||
case 1:
|
||||
params.placement = 'l';
|
||||
break;
|
||||
case 2:
|
||||
params.placement = 'r';
|
||||
break;
|
||||
case 3:
|
||||
params.placement = 'p';
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
params.placement.erase();
|
||||
break;
|
||||
}
|
||||
|
||||
controller().dispatchParams();
|
||||
}
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
44
src/frontends/gtk/GWrap.h
Normal file
44
src/frontends/gtk/GWrap.h
Normal file
@ -0,0 +1,44 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GWrap.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GWRAPH
|
||||
#define GWRAP_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
#include "GtkLengthEntry.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlWrap;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Wrap Dialog.
|
||||
*/
|
||||
class GWrap : public GViewCB<ControlWrap, GViewGladeB> {
|
||||
public:
|
||||
GWrap(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
// apply() won't act when this is true
|
||||
bool applylock_;
|
||||
|
||||
Gtk::ComboBox *placementcombo_;
|
||||
GtkLengthEntry *widthlengthentry_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GWRAP_H
|
@ -113,6 +113,8 @@ libgtk_la_SOURCES = \
|
||||
GVSpace.h \
|
||||
GWorkArea.C \
|
||||
GWorkArea.h \
|
||||
GWrap.C \
|
||||
GWrap.h \
|
||||
GXpmBtnTbl.C \
|
||||
GXpmBtnTbl.h \
|
||||
LyXGdkImage.C \
|
||||
|
@ -36,4 +36,5 @@ dist_glade_DATA = \
|
||||
thesaurus.glade \
|
||||
toc.glade \
|
||||
url.glade \
|
||||
vspace.glade
|
||||
vspace.glade \
|
||||
wrap.glade
|
||||
|
170
src/frontends/gtk/glade/wrap.glade
Normal file
170
src/frontends/gtk/glade/wrap.glade
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkDialog" id="dialog">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">dialog1</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="Close">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-7</property>
|
||||
<accelerator key="Escape" modifiers="0" signal="clicked"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTable" id="table1">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">2</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<property name="column_spacing">12</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Width:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Placement:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="right_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="Width">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="bottom_attach">1</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="Placement">
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes">Default
|
||||
Left
|
||||
Right
|
||||
Outer</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">fill</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
Loading…
x
Reference in New Issue
Block a user