Here a patch which fixes the table toolbar bug,
mainly the code removing in Toolbars.C does the job.

But then the hiding must be improved which forces a
more complete CT toolbar impl.

With this patch the only missing part is the setting
of the change track flag, which now is always enabled.

Michael, could you incorporate my CT changes into your
patches and commiting it? (maybe you wanna rename
TRACKING to REVIEW or so)

Peter
Index: src/frontends/Toolbars.C
===================================================================
--- src/frontends/Toolbars.C    (revision 15587)
+++ src/frontends/Toolbars.C    (working copy)
@@ -65,7 +65,7 @@
 }
 
 
-void Toolbars::update(bool in_math, bool in_table)
+void Toolbars::update(bool in_math, bool in_table, bool change_tracking)
 {
        update();
 
@@ -78,6 +78,8 @@
                        displayToolbar(*cit, in_math);
                else if (cit->flags & ToolbarBackend::TABLE)
                        displayToolbar(*cit, in_table);
+               else if (cit->flags & ToolbarBackend::TRACKING)
+                       displayToolbar(*cit, change_tracking);
        }
 }
 
@@ -122,11 +124,6 @@
        ToolbarPtr tb_ptr = owner_.makeToolbar(tbb);
        toolbars_[tbb.name] = tb_ptr;
 
-       if (tbb.flags & ToolbarBackend::ON)
-               tb_ptr->show(false);
-       else
-               tb_ptr->hide(false);
-
        if (tb_ptr->layout())
                layout_ = tb_ptr->layout();
 }
Index: src/frontends/LyXView.C
===================================================================
--- src/frontends/LyXView.C     (revision 15587)
+++ src/frontends/LyXView.C     (working copy)
@@ -290,7 +290,13 @@
        bool const math = work_area_->bufferView().cursor().inMathed();
        bool const table =
                lyx::getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
-       toolbars_->update(math, table);
+       bool change_tracking = false;
+       if (work_area_->bufferView().buffer()){
+               // TODO: 
+               //change_tracking = 
work_area_->bufferView().getStatus(FuncRequest(LFUN_CHANGES_TRACK)).enabled();
+       }
+               
+       toolbars_->update(math, table, change_tracking);
        // update redaonly status of open dialogs. This could also be in
        // updateMenubar(), but since updateToolbars() and updateMenubar()
        // are always called together it is only here.
 
 
Index: src/frontends/Toolbars.h
===================================================================
--- src/frontends/Toolbars.h    (revision 15587)
+++ src/frontends/Toolbars.h    (working copy)
@@ -82,8 +82,9 @@
 
        /// Show/hide the named toolbar.
        void display(std::string const & name, bool show);
+
        /// Update the state of the toolbars.
-       void update(bool in_math, bool in_table);
+       void update(bool in_math, bool in_table, bool change_tracking);
 
        /// Select the right layout in the combox.
        void setLayout(std::string const & layout);
Index: src/BufferView.C
===================================================================
--- src/BufferView.C    (revision 15587)
+++ src/BufferView.C    (working copy)
@@ -668,6 +668,7 @@
                break;
 
        case LFUN_CHANGES_TRACK:
+               // TODO: switch with the GUI
                flag.enabled(true);
                flag.setOnOff(buffer_->params().trackChanges);
                break;
Index: src/ToolbarBackend.C
===================================================================
--- src/ToolbarBackend.C        (revision 15587)
+++ src/ToolbarBackend.C        (working copy)
@@ -194,6 +194,8 @@
                                flag = LEFT;
                        else if (!compare_ascii_no_case(*cit, "right"))
                                flag = RIGHT;
+                       else if (!compare_ascii_no_case(*cit, "review"))
+                               flag = TRACKING;
                        else {
                                lyxerr << "ToolbarBackend::read: unrecognised 
token:`"
                                       << *cit << '\'' << endl;
Index: src/ToolbarBackend.h
===================================================================
--- src/ToolbarBackend.h        (revision 15587)
+++ src/ToolbarBackend.h        (working copy)
@@ -52,7 +52,8 @@
                TOP = 16, //< show at top
                BOTTOM = 32, //< show at bottom
                LEFT = 64, //< show at left
-               RIGHT = 128 //< show at right
+               RIGHT = 128, //< show at right
+               TRACKING = 256 //< shown when change tracking is enabled
        };
 
        /// a toolbar
Index: lib/ui/default.ui
===================================================================
--- lib/ui/default.ui   (revision 15587)
+++ lib/ui/default.ui   (working copy)
@@ -38,4 +38,5 @@
        "table" "table,bottom"
        "math" "math,bottom"
        "minibuffer" "off,bottom"
+       "review" "review,top"
 End

Reply via email to