]> git.lyx.org Git - features.git/commitdiff
Ease the pain with unknown branches:
authorJürgen Spitzmüller <spitz@lyx.org>
Thu, 9 Jul 2009 09:48:34 +0000 (09:48 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Thu, 9 Jul 2009 09:48:34 +0000 (09:48 +0000)
* on paste, ask if unknown branches shall be added to the branch list
  (entails new LFUN_BRANCH_ADD)
* add a list of undefined branches to the buffer and the GUI

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30419 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
development/scons/scons_manifest.py
src/Buffer.cpp
src/Buffer.h
src/CutAndPaste.cpp
src/FuncCode.h
src/LyXAction.cpp
src/frontends/qt4/GuiBranches.cpp
src/frontends/qt4/GuiBranches.h
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiDocument.h
src/frontends/qt4/Makefile.am
src/frontends/qt4/ui/BranchesUi.ui
src/frontends/qt4/ui/BranchesUnknownUi.ui [new file with mode: 0644]
src/frontends/qt4/ui/DocumentUi.ui
src/insets/InsetBranch.h

index 92dcf9c7bc5c49d4798fb84d85165a99d98fcdef..801e68761991b47184c92ffb5fdb2ae97bb56977 100644 (file)
@@ -898,6 +898,7 @@ src_frontends_qt4_ui_files = Split('''
     BoxUi.ui
     BranchUi.ui
     BranchesUi.ui
+    BranchesUnknownUi.ui
     BulletsUi.ui
     ChangesUi.ui
     CharacterUi.ui
index c9dadd0837744e35f4243fc54c49d6024c53b4e2..f0c4a53859b7688dd5b793203c5a48b283f3cba6 100644 (file)
@@ -69,6 +69,7 @@
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetBibtex.h"
+#include "insets/InsetBranch.h"
 #include "insets/InsetInclude.h"
 #include "insets/InsetText.h"
 
@@ -1621,6 +1622,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                        break;
                }
 
+               case LFUN_BRANCH_ADD:
                case LFUN_BUFFER_PRINT:
                        // if no Buffer is present, then of course we won't be called!
                        flag.setEnabled(true);
@@ -1657,6 +1659,28 @@ void Buffer::dispatch(FuncRequest const & func, DispatchResult & dr)
                break;
        }
 
+       case LFUN_BRANCH_ADD: {
+               BranchList & branchList = params().branchlist();
+               docstring const branchName = func.argument();
+               if (branchName.empty()) {
+                       dispatched = false;
+                       break;
+               }
+               Branch * branch = branchList.find(branchName);
+               if (branch) {
+                       LYXERR0("Branch " << branchName << " does already exist.");
+                       dr.setError(true);
+                       docstring const msg = 
+                               bformat(_("Branch \"%1$s\" does already exist."), branchName);
+                       dr.setMessage(msg);
+               } else {
+                       branchList.add(branchName);
+                       dr.setError(false);
+                       dr.update(Update::Force);
+               }
+               break;
+       }
+
        case LFUN_BRANCH_ACTIVATE:
        case LFUN_BRANCH_DEACTIVATE: {
                BranchList & branchList = params().branchlist();
@@ -2328,6 +2352,59 @@ void Buffer::updateMacros() const
 }
 
 
+void Buffer::getUsedBranches(std::list<docstring> & result, bool const from_master) const
+{
+       // Iterate over buffer, starting with first paragraph
+       // The scope must be bigger than any lookup DocIterator
+       // later. For the global lookup, lastpit+1 is used, hence
+       // we use lastpit+2 here.
+       DocIterator it = par_iterator_begin();
+       DocIterator scope = it;
+       scope.pit() = scope.lastpit() + 2;
+       pit_type lastpit = it.lastpit();
+
+       while (it.pit() <= lastpit) {
+               Paragraph & par = it.paragraph();
+
+               // iterate over the insets of the current paragraph
+               InsetList const & insets = par.insetList();
+               InsetList::const_iterator iit = insets.begin();
+               InsetList::const_iterator end = insets.end();
+               for (; iit != end; ++iit) {
+                       it.pos() = iit->pos;
+
+                       if (iit->inset->lyxCode() == BRANCH_CODE) {
+                               // get buffer of external file
+                               InsetBranch const & br =
+                                       static_cast<InsetBranch const &>(*iit->inset);
+                               docstring const name = br.branch();
+                               if (!from_master && !params().branchlist().find(name))
+                                       result.push_back(name);
+                               else if (from_master && !masterBuffer()->params().branchlist().find(name))
+                                       result.push_back(name);
+                               continue;
+                       }
+
+                       // is it an external file?
+                       if (iit->inset->lyxCode() == INCLUDE_CODE) {
+                               // get buffer of external file
+                               InsetInclude const & inset =
+                                       static_cast<InsetInclude const &>(*iit->inset);
+                               Buffer * child = inset.getChildBuffer();
+                               if (!child)
+                                       continue;
+                               child->getUsedBranches(result, true);
+                       }
+               }
+               // next paragraph
+               it.pit()++;
+               it.pos() = 0;
+       }
+       // remove duplicates
+       result.unique();
+}
+
+
 void Buffer::updateMacroInstances() const
 {
        LYXERR(Debug::MACROS, "updateMacroInstances for "
@@ -3106,7 +3183,7 @@ void Buffer::updateLabels(UpdateScope scope) const
                        // Do this here in case the master has no gui associated with it. Then, 
                        // the TocModel is not updated and TocModel::toc_ is invalid (bug 5699).
                        if (!master->gui_)
-                               structureChanged();     
+                               structureChanged();
 
                        // was buf referenced from the master (i.e. not in bufToUpdate anymore)?
                        if (bufToUpdate.find(this) == bufToUpdate.end())
index 7493807bec029a652875f25ce842d1e40aaae716..71e8ac32c13ce92f42abfc2f3b86b2b074f610b4 100644 (file)
@@ -20,6 +20,7 @@
 #include "support/types.h"
 #include "support/SignalSlot.h"
 
+#include <list>
 #include <string>
 #include <vector>
 
@@ -506,6 +507,9 @@ public:
        void setInsetLabel(docstring const & label, InsetLabel const * il);
        InsetLabel const * insetLabel(docstring const & label) const;
 
+       /// return a list of all used branches (also in children)
+       void getUsedBranches(std::list<docstring> &, bool const from_master = false) const;
+
        /// sets the buffer_ member for every inset in this buffer.
        // FIXME This really shouldn't be needed, but at the moment it's not
        // clear how to do it just for the individual pieces we need.
index ecb4cbcafbaddca26dd6d71779a35775eea70975..b85aa21c34417993062d68d1204f8e3c45707773 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "CutAndPaste.h"
 
+#include "BranchList.h"
 #include "Buffer.h"
 #include "buffer_funcs.h"
 #include "BufferList.h"
@@ -37,8 +38,9 @@
 #include "ParIterator.h"
 #include "Undo.h"
 
-#include "insets/InsetFlex.h"
+#include "insets/InsetBranch.h"
 #include "insets/InsetCommand.h"
+#include "insets/InsetFlex.h"
 #include "insets/InsetGraphics.h"
 #include "insets/InsetGraphicsParams.h"
 #include "insets/InsetInclude.h"
@@ -54,6 +56,7 @@
 #include "support/limited_stack.h"
 #include "support/lstrings.h"
 
+#include "frontends/alert.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Selection.h"
 
@@ -271,6 +274,31 @@ pasteSelectionHelper(Cursor & cur, ParagraphList const & parlist,
                        break;
                }
 
+               case BRANCH_CODE: {
+                       // check if branch is known to target buffer
+                       // or its master
+                       InsetBranch & br = static_cast<InsetBranch &>(*it);
+                       docstring const name = br.branch();
+                       if (name.empty())
+                               break;
+                       bool const is_child = (&buffer != buffer.masterBuffer());
+                       BranchList branchlist = buffer.params().branchlist();
+                       if ((!is_child && branchlist.find(name))
+                           || (is_child && (branchlist.find(name)
+                               || buffer.masterBuffer()->params().branchlist().find(name))))
+                               break;
+                       // FIXME: add an option to add the branch to the master's BranchList.
+                       docstring text = bformat(
+                                       _("The pasted branch \"%1$s\" is undefined.\n"
+                                         "Do you want to add it to the document's branch list?"),
+                                       name);
+                       if (frontend::Alert::prompt(_("Unknown branch"),
+                                         text, 0, 1, _("&Add"), _("&Don't Add")) != 0)
+                               break;
+                       lyx::dispatch(FuncRequest(LFUN_BRANCH_ADD, name));
+                       break;
+               }
+
                default:
                        break; // nothing
                }
index 26d484da6c67114f9b8580ac49835c08072662e0..e618bbe1f6c2198e674b27bee4a25b8e11fee340 100644 (file)
@@ -435,6 +435,7 @@ enum FuncCode
        LFUN_FONT_UWAVE,
        LFUN_BUFFER_EXPORT,             // Lgb 97-07-29
        LFUN_BUFFER_TOGGLE_COMPRESSION, // bpeng 20060427
+       LFUN_BRANCH_ADD,                // spitz 20090707
 
        LFUN_LASTACTION                 // end of the table
 };
index 110c8b8890a89f8ef4d5c382d7980e500a777f56..dace7fa57e2ec5453a84326eb0f0f1574a73167b 100644 (file)
@@ -3284,6 +3284,17 @@ void LyXAction::init()
                { LFUN_COMPLETION_ACCEPT, "completion-accept", SingleParUpdate, Edit },
 
 
+/*!
+ * \var lyx::FuncCode lyx::LFUN_BRANCH_ADD
+ * \li Action: Add a branch to the buffer's BranchList
+ * \li Syntax: branch-add <BRANCH>
+ * \li Params: <BRANCH>: Name of the branch to add
+ * \li Origin: spitz, 7 Jul 2009
+ * \endvar
+ */
+               { LFUN_BRANCH_ADD, "branch-add", Noop, Buffer },
+
+
 /*!
  * \var lyx::FuncCode lyx::LFUN_BRANCH_ACTIVATE
  * \li Action: Activate the branch
index 233601caf3ca88c9a2a6c1a149a4fada047d3e8d..a38b034b5d4ce4ff320cc42a0cc8b51c63a081cc 100644 (file)
 #include "Validator.h"
 #include "qt_helpers.h"
 
+#include "ui_BranchesUnknownUi.h"
+
+#include "Buffer.h"
 #include "BufferParams.h"
 
 #include "support/lstrings.h"
 
+#include <QListWidget>
 #include <QTreeWidget>
 #include <QTreeWidgetItem>
 #include <QPixmap>
@@ -43,6 +47,23 @@ GuiBranches::GuiBranches(QWidget * parent)
        branchesTW->headerItem()->setText(1, qt_("Activated"));
        branchesTW->headerItem()->setText(2, qt_("Color"));
        branchesTW->setSortingEnabled(true);
+
+       undef_ = new BranchesUnknownDialog(this);
+       undef_bc_.setPolicy(ButtonPolicy::OkCancelPolicy);
+       undef_bc_.setCancel(undef_->cancelPB);
+
+       connect(undef_->branchesLW, SIGNAL(itemSelectionChanged()),
+               this, SLOT(unknownBranchSelChanged()));
+       connect(undef_->addSelectedPB, SIGNAL(clicked()),
+               this, SLOT(addUnknown()));
+       connect(undef_->addAllPB, SIGNAL(clicked()),
+               this, SLOT(addAllUnknown()));
+       connect(undef_->addSelectedPB, SIGNAL(clicked()),
+               undef_, SLOT(accept()));
+       connect(undef_->addAllPB, SIGNAL(clicked()),
+               undef_, SLOT(accept()));
+       connect(undef_->cancelPB, SIGNAL(clicked()),
+               undef_, SLOT(reject()));
 }
 
 void GuiBranches::update(BufferParams const & params)
@@ -83,6 +104,7 @@ void GuiBranches::updateView()
                        branchesTW->setItemSelected(newItem, true);
                }
        }
+       unknownPB->setEnabled(!unknown_branches_.isEmpty());
        // emit signal
        changed();
 }
@@ -183,6 +205,49 @@ void GuiBranches::toggleColor(QTreeWidgetItem * item)
        updateView();
 }
 
+
+void GuiBranches::on_unknownPB_pressed()
+{
+       undef_->branchesLW->clear();
+       for (int i = 0; i != unknown_branches_.count(); ++i) {
+               if (branchesTW->findItems(unknown_branches_[i], Qt::MatchExactly, 0).empty())
+                       undef_->branchesLW->addItem(unknown_branches_[i]);
+       }
+       unknownBranchSelChanged();
+       undef_->exec();
+}
+
+
+void GuiBranches::addUnknown()
+{
+       QList<QListWidgetItem *> selItems =
+               undef_->branchesLW->selectedItems();
+       
+       QList<QListWidgetItem *>::const_iterator it = selItems.begin();
+       for (it ; it != selItems.end() ; ++it) {
+               QListWidgetItem const * new_branch = *it;
+               if (new_branch) {
+                       branchlist_.add(qstring_to_ucs4(new_branch->text()));
+                       updateView();
+               }
+       }
+}
+
+
+void GuiBranches::addAllUnknown()
+{
+       undef_->branchesLW->selectAll();
+       addUnknown();
+}
+
+
+void GuiBranches::unknownBranchSelChanged()
+{
+       undef_->addSelectedPB->setEnabled(
+               !undef_->branchesLW->selectedItems().isEmpty());
+}
+
+
 } // namespace frontend
 } // namespace lyx
 
index bde09cd1a2f7fe0a3083594511592aad08a0fac3..3edf0970ea4e0f0ef486e762e4614620190fbe08 100644 (file)
@@ -12,7 +12,9 @@
 #ifndef GUIBRANCHES_H
 #define GUIBRANCHES_H
 
+#include "Buffer.h"
 #include "GuiDocument.h"
+#include "ui_BranchesUnknownUi.h"
 #include "ui_BranchesUi.h"
 #include "BranchList.h"
 
@@ -26,6 +28,16 @@ class BufferParams;
 
 namespace frontend {
 
+class BranchesUnknownDialog : public QDialog, public Ui::BranchesUnknownUi
+{
+public:
+       BranchesUnknownDialog(QWidget * parent) : QDialog(parent)
+       {
+               Ui::BranchesUnknownUi::setupUi(this);
+               QDialog::setModal(true);
+       }
+};
+
 class GuiBranches : public QWidget, public Ui::BranchesUi
 {
        Q_OBJECT
@@ -34,6 +46,7 @@ public:
 
        void update(BufferParams const & params);
        void apply(BufferParams & params) const;
+       void setUnknownBranches(QStringList const & b) { unknown_branches_ = b; }
 
 Q_SIGNALS:
        void changed();
@@ -49,10 +62,20 @@ protected Q_SLOTS:
        void on_activatePB_pressed();
        void on_branchesTW_itemDoubleClicked(QTreeWidgetItem *, int);
        void on_colorPB_clicked();
+       void on_unknownPB_pressed();
+       void addUnknown();
+       void addAllUnknown();
+       void unknownBranchSelChanged();
 
 private:
        /// Contains all legal branches for this doc
        BranchList branchlist_;
+       ///
+       BranchesUnknownDialog * undef_;
+       ///
+       ButtonController undef_bc_;
+       ///
+       QStringList unknown_branches_;
 };
 
 } // namespace frontend
index 7521e48332572f727fefd8288a1566e336a2581d..7aeac973d1a4d02adf22243582df41d85839f47b 100644 (file)
@@ -946,6 +946,7 @@ GuiDocument::GuiDocument(GuiView & lv)
        branchesModule = new GuiBranches;
        connect(branchesModule, SIGNAL(changed()),
                this, SLOT(change_adaptor()));
+       updateUnknownBranches();
 
        // preamble
        preambleModule = new PreambleModule;
@@ -2413,6 +2414,8 @@ void GuiDocument::paramsToDialog()
        lengthToWidgets(m->columnsepLE, m->columnsepUnit,
                bp_.columnsep, defaultUnit);
 
+       // branches
+       updateUnknownBranches();
        branchesModule->update(bp_);
 
        // PDF support
@@ -2795,6 +2798,20 @@ void GuiDocument::loadModuleInfo()
 }
 
 
+void GuiDocument::updateUnknownBranches()
+{
+       list<docstring> used_branches;
+       buffer().getUsedBranches(used_branches);
+       list<docstring>::const_iterator it = used_branches.begin();
+       QStringList unknown_branches;
+       for (it ; it != used_branches.end() ; ++it) {
+               if (!buffer().params().branchlist().find(*it))
+                       unknown_branches.append(toqstr(*it));
+       }
+       branchesModule->setUnknownBranches(unknown_branches);
+}
+
+
 Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }
 
 
index fa62c25496247ea43f88434c49360b5efc9b703f..ea87a21bc34eb8fe8784187cb2b480899a334174 100644 (file)
@@ -215,6 +215,8 @@ private:
        ///
        void loadModuleInfo();
        ///
+       void updateUnknownBranches();
+       ///
        BufferParams bp_;
        /// List of names of available modules
        std::list<modInfoStruct> moduleNames_;
index 634e336ce8b545c9988b76e08cf2fe19973a6986..9dd823d8de4fda33eeff4fcb83384856787ad7f7 100644 (file)
@@ -244,6 +244,7 @@ UIFILES = \
        BibtexUi.ui \
        BoxUi.ui \
        BranchesUi.ui \
+       BranchesUnknownUi.ui \
        BranchUi.ui \
        BulletsUi.ui \
        ChangesUi.ui \
index cf7fd59c1f589d1130f5e44d9433f5fe585bb507..4ceab17015d3146fc302b4a7c741b4b26210aae1 100644 (file)
@@ -1,7 +1,4 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>BranchesUi</class>
  <widget class="QWidget" name="BranchesUi" >
   <property name="geometry" >
@@ -9,7 +6,7 @@
     <x>0</x>
     <y>0</y>
     <width>401</width>
-    <height>300</height>
+    <height>327</height>
    </rect>
   </property>
   <property name="windowTitle" >
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item row="0" column="1" >
-    <widget class="QLineEdit" name="newBranchLE" />
+   <item row="7" column="2" colspan="2" >
+    <widget class="QPushButton" name="unknownPB" >
+     <property name="toolTip" >
+      <string>Show undefined branches used in this document.</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Undefined Branches</string>
+     </property>
+    </widget>
    </item>
-   <item row="5" column="2" >
+   <item row="4" column="3" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Vertical</enum>
      </property>
     </spacer>
    </item>
-   <item row="0" column="2" >
-    <widget class="QPushButton" name="addBranchPB" >
-     <property name="toolTip" >
-      <string>Add a new branch to the list</string>
+   <item row="7" column="0" colspan="2" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
      </property>
-     <property name="text" >
-      <string>&amp;Add</string>
+     <property name="sizeHint" >
+      <size>
+       <width>251</width>
+       <height>20</height>
+      </size>
      </property>
-    </widget>
+    </spacer>
    </item>
-   <item row="1" column="0" colspan="2" >
+   <item row="1" column="0" colspan="3" >
     <widget class="QLabel" name="availableLB" >
      <property name="text" >
       <string>A&amp;vailable Branches:</string>
      </property>
     </widget>
    </item>
-   <item row="0" column="0" >
-    <widget class="QLabel" name="newBranchLA" >
-     <property name="text" >
-      <string>&amp;New:</string>
-     </property>
-     <property name="buddy" >
-      <cstring>newBranchLE</cstring>
-     </property>
-    </widget>
-   </item>
-   <item rowspan="4" row="2" column="0" colspan="2" >
-    <widget class="QTreeWidget" name="branchesTW" />
-   </item>
-   <item row="2" column="2" >
+   <item row="2" column="3" >
     <widget class="QPushButton" name="removePB" >
      <property name="toolTip" >
       <string>Remove the selected branch</string>
@@ -84,7 +78,7 @@
      </property>
     </widget>
    </item>
-   <item row="5" column="2" >
+   <item row="5" column="3" >
     <widget class="QPushButton" name="activatePB" >
      <property name="toolTip" >
       <string>Toggle the selected branch</string>
@@ -94,7 +88,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="2" >
+   <item row="3" column="3" >
     <widget class="QPushButton" name="colorPB" >
      <property name="toolTip" >
       <string>Define or change background color</string>
      </property>
     </widget>
    </item>
+   <item rowspan="5" row="2" column="0" colspan="3" >
+    <widget class="QTreeWidget" name="branchesTW" />
+   </item>
+   <item row="0" column="0" >
+    <widget class="QLabel" name="newBranchLA" >
+     <property name="text" >
+      <string>&amp;New:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>newBranchLE</cstring>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="3" >
+    <widget class="QPushButton" name="addBranchPB" >
+     <property name="toolTip" >
+      <string>Add a new branch to the list</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Add</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1" colspan="2" >
+    <widget class="QLineEdit" name="newBranchLE" />
+   </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
  <includes>
   <include location="local" >qt_i18n.h</include>
  </includes>
diff --git a/src/frontends/qt4/ui/BranchesUnknownUi.ui b/src/frontends/qt4/ui/BranchesUnknownUi.ui
new file mode 100644 (file)
index 0000000..de8f1ff
--- /dev/null
@@ -0,0 +1,92 @@
+<ui version="4.0" >
+ <class>BranchesUnknownUi</class>
+ <widget class="QWidget" name="BranchesUnknownUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>401</width>
+    <height>234</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item row="1" column="1" >
+    <widget class="QPushButton" name="addSelectedPB" >
+     <property name="toolTip" >
+      <string>Add the selected branches to the list.</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Add Selected</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1" >
+    <widget class="QPushButton" name="addAllPB" >
+     <property name="toolTip" >
+      <string>Add all unknown branches to the list.</string>
+     </property>
+     <property name="text" >
+      <string>Add A&amp;ll</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1" >
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" >
+      <size>
+       <width>20</width>
+       <height>81</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="4" column="1" >
+    <widget class="QPushButton" name="cancelPB" >
+     <property name="text" >
+      <string>&amp;Cancel</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" >
+    <widget class="QLabel" name="branchesLA" >
+     <property name="toolTip" >
+      <string>Undefined branches used in this document.</string>
+     </property>
+     <property name="text" >
+      <string>&amp;Undefined Branches:</string>
+     </property>
+     <property name="buddy" >
+      <cstring>branchesLW</cstring>
+     </property>
+    </widget>
+   </item>
+   <item rowspan="4" row="1" column="0" >
+    <widget class="QListWidget" name="branchesLW" >
+     <property name="toolTip" >
+      <string>Undefined branches used in this document.</string>
+     </property>
+     <property name="selectionMode" >
+      <enum>QAbstractItemView::MultiSelection</enum>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <includes>
+  <include location="local" >qt_i18n.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
index 4858ed4e297b6f33f8f09c49fa1db1f1b34f8b0a..cebd253e3754807908dc8d80bde1195ae50676db 100644 (file)
@@ -1,15 +1,12 @@
 <ui version="4.0" >
- <author></author>
- <comment></comment>
- <exportmacro></exportmacro>
  <class>DocumentUi</class>
  <widget class="QDialog" name="DocumentUi" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>422</width>
-    <height>124</height>
+    <width>436</width>
+    <height>175</height>
    </rect>
   </property>
   <property name="sizePolicy" >
   <property name="sizeGripEnabled" >
    <bool>true</bool>
   </property>
-  <layout class="QVBoxLayout" >
+  <layout class="QGridLayout" >
    <property name="margin" >
-    <number>11</number>
+    <number>9</number>
    </property>
    <property name="spacing" >
     <number>6</number>
    </property>
-   <item>
-    <widget class="lyx::frontend::PanelStack" name="docPS" />
-   </item>
-   <item>
+   <item row="0" column="0" >
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
       <number>6</number>
      </property>
      <item>
-      <widget class="QPushButton" name="defaultPB" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>3</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
+      <widget class="QRadioButton" name="childRB" >
        <property name="toolTip" >
-        <string>Reset to the default settings for the document class</string>
+        <string>Click to edit the settings of the child document</string>
        </property>
        <property name="text" >
-        <string>Use Class Defaults</string>
+        <string>Child Settings</string>
        </property>
       </widget>
      </item>
      <item>
-      <widget class="QPushButton" name="savePB" >
-       <property name="sizePolicy" >
-        <sizepolicy>
-         <hsizetype>3</hsizetype>
-         <vsizetype>0</vsizetype>
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
+      <widget class="QRadioButton" name="masterRB" >
        <property name="toolTip" >
-        <string>Save settings as LyX's default document settings</string>
+        <string>Click to edit the settings of the Master document</string>
        </property>
        <property name="text" >
-        <string>Save as Document Defaults</string>
+        <string>Master Settings</string>
        </property>
       </widget>
      </item>
        <property name="orientation" >
         <enum>Qt::Horizontal</enum>
        </property>
-       <property name="sizeType" >
-        <enum>QSizePolicy::Expanding</enum>
-       </property>
        <property name="sizeHint" >
         <size>
-         <width>20</width>
+         <width>181</width>
          <height>20</height>
         </size>
        </property>
@@ -98,7 +73,7 @@
      </item>
     </layout>
    </item>
-   <item>
+   <item row="3" column="0" >
     <layout class="QHBoxLayout" >
      <property name="margin" >
       <number>0</number>
      </item>
     </layout>
    </item>
+   <item row="2" column="0" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QPushButton" name="defaultPB" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>3</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip" >
+        <string>Reset to the default settings for the document class</string>
+       </property>
+       <property name="text" >
+        <string>Use Class Defaults</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="savePB" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>3</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip" >
+        <string>Save settings as LyX's default document settings</string>
+       </property>
+       <property name="text" >
+        <string>Save as Document Defaults</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="1" column="0" >
+    <widget class="lyx::frontend::PanelStack" native="1" name="docPS" />
+   </item>
   </layout>
  </widget>
- <pixmapfunction></pixmapfunction>
- <includes>
-  <include location="local" >qt_i18n.h</include>
- </includes>
  <customwidgets>
   <customwidget>
    <class>lyx::frontend::PanelStack</class>
-   <extends></extends>
+   <extends>QWidget</extends>
    <header>PanelStack.h</header>
    <container>1</container>
-   <pixmap></pixmap>
   </customwidget>
  </customwidgets>
+ <includes>
+  <include location="local" >qt_i18n.h</include>
+ </includes>
  <resources/>
  <connections/>
 </ui>
index 47e963dc943bc7dc233c246646097b54e001c792..a2f6c28a20b47fb52094aa068d912aada2fddc75 100644 (file)
@@ -51,6 +51,8 @@ public:
        static std::string params2string(InsetBranchParams const &);
        ///
        static void string2params(std::string const &, InsetBranchParams &);
+       ///
+       docstring branch() const { return params_.branch; }
 
 private:
        ///