mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
Bernhard's GTK Branch dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10780 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
38513eb5cc
commit
d62eeda965
@ -1,3 +1,8 @@
|
||||
2006-01-27 Bernhard Reiter <ockham@gmx.net>
|
||||
|
||||
* GBranch.[Ch], glade/branch.glade: Add the Branches dialog
|
||||
* Dialogs.C, Makefile.am, glade/Makefile.am: Use GBranch
|
||||
|
||||
2006-01-25 Georg Baum <Georg.Baum@post.rwth-aachen.de>
|
||||
|
||||
* xftFontLoader.C: remove obsolete header
|
||||
|
@ -61,7 +61,7 @@
|
||||
#include "GBibItem.h"
|
||||
//#include "FormBibtex.h"
|
||||
#include "GBox.h"
|
||||
//#include "FormBranch.h"
|
||||
#include "GBranch.h"
|
||||
#include "GChanges.h"
|
||||
#include "GCharacter.h"
|
||||
#include "GCitation.h"
|
||||
@ -484,9 +484,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
dialog->setView(new GNote(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "branch") {
|
||||
// dialog->bc().view(new xformsBC(dialog->bc()));
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlBranch(*dialog));
|
||||
// dialog->setView(new FormBranch(*dialog));
|
||||
dialog->setView(new GBranch(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "paragraph") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
|
103
src/frontends/gtk/GBranch.C
Normal file
103
src/frontends/gtk/GBranch.C
Normal file
@ -0,0 +1,103 @@
|
||||
/**
|
||||
* \file GBranch.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* 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 "GBranch.h"
|
||||
#include "ControlBranch.h"
|
||||
|
||||
#include "BranchList.h"
|
||||
#include "insets/insetbranch.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
#include <libglademm.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
GBranch::GBranch(Dialog & parent)
|
||||
: GViewCB<ControlBranch, GViewGladeB>(parent, _("Branch Settings"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GBranch::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("branch");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("Cancel", cancelbutton_);
|
||||
setCancel(cancelbutton_);
|
||||
xml_->get_widget("OK", okbutton_);
|
||||
setOK(okbutton_);
|
||||
|
||||
Gtk::Box * box = NULL;
|
||||
xml_->get_widget("innerbox", box);
|
||||
box->pack_start(branchescombo_, true, true, 0);
|
||||
box->show_all();
|
||||
|
||||
// Set shortcut target
|
||||
xml_->get_widget("BranchesLabel", brancheslabel_);
|
||||
brancheslabel_->set_mnemonic_widget(branchescombo_);
|
||||
|
||||
// Single click in branches list
|
||||
branchescombo_.signal_changed().connect(
|
||||
sigc::mem_fun(*this, &GBranch::selection_changed));
|
||||
|
||||
}
|
||||
|
||||
|
||||
void GBranch::update()
|
||||
{
|
||||
applylock_ = true;
|
||||
|
||||
typedef BranchList::const_iterator const_iterator;
|
||||
|
||||
BranchList const branchlist = controller().branchlist();
|
||||
string const cur_branch = controller().params().branch;
|
||||
|
||||
branchescombo_.clear_items();
|
||||
|
||||
const_iterator const begin = branchlist.begin();
|
||||
const_iterator const end = branchlist.end();
|
||||
for (const_iterator it = begin; it != end; ++it)
|
||||
branchescombo_.append_text(it->getBranch());
|
||||
branchescombo_.set_active_text(cur_branch);
|
||||
|
||||
applylock_ = false;
|
||||
}
|
||||
|
||||
|
||||
void GBranch::apply()
|
||||
{
|
||||
controller().params().branch = branchescombo_.get_active_text();;
|
||||
}
|
||||
|
||||
|
||||
void GBranch::selection_changed()
|
||||
{
|
||||
if (!applylock_)
|
||||
bc().valid(true);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
49
src/frontends/gtk/GBranch.h
Normal file
49
src/frontends/gtk/GBranch.h
Normal file
@ -0,0 +1,49 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GBranch.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Reiter
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GBRANCH_H
|
||||
#define GBRANCH_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlBranch;
|
||||
|
||||
/** This class provides a GTK+ implementation of the Branch Dialog.
|
||||
*/
|
||||
class GBranch : public GViewCB<ControlBranch, GViewGladeB> {
|
||||
public:
|
||||
GBranch(Dialog & parent);
|
||||
private:
|
||||
virtual void apply();
|
||||
virtual void doBuild();
|
||||
virtual void update();
|
||||
|
||||
/// enables the apply button if a synonym is selected from the list
|
||||
void selection_changed();
|
||||
|
||||
/** apply() won't act when this is true.
|
||||
true if no text is selected when the Branch dialog is opened
|
||||
*/
|
||||
bool applylock_;
|
||||
|
||||
Gtk::Button * cancelbutton_;
|
||||
Gtk::Button * okbutton_;
|
||||
Gtk::Label * brancheslabel_;
|
||||
Gtk::ComboBoxText branchescombo_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GBRANCH_H
|
@ -33,6 +33,8 @@ libgtk_la_SOURCES = \
|
||||
GBibItem.h \
|
||||
GBox.C \
|
||||
GBox.h \
|
||||
GBranch.C \
|
||||
GBranch.h \
|
||||
GChanges.C \
|
||||
GChanges.h \
|
||||
GCharacter.C \
|
||||
|
@ -5,8 +5,9 @@ DISTCLEANFILES += *.gladep
|
||||
gladedir = $(pkgdatadir)/glade
|
||||
dist_glade_DATA = \
|
||||
aboutlyx.glade \
|
||||
box.glade \
|
||||
bibitem.glade \
|
||||
box.glade \
|
||||
branch.glade \
|
||||
changes.glade \
|
||||
character.glade \
|
||||
citation.glade \
|
||||
|
129
src/frontends/gtk/glade/branch.glade
Normal file
129
src/frontends/gtk/glade/branch.glade
Normal file
@ -0,0 +1,129 @@
|
||||
<?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">True</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="urgency_hint">False</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="Cancel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-cancel</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">-6</property>
|
||||
<accelerator key="Escape" modifiers="0" signal="clicked"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="OK">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="has_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-ok</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">-5</property>
|
||||
</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="GtkVBox" id="outerbox">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="BranchesLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Available branches:</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="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="innerbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</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…
Reference in New Issue
Block a user