]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/FormDocument.C
More pref work from Angus
[lyx.git] / src / frontends / xforms / FormDocument.C
index c7e32b1ae68f361aabe5ace68b05ecb42c04a24b..2c47d4c7e7d861a5f0bdec2b6b19eee94babf703 100644 (file)
@@ -45,8 +45,8 @@ using Liason::setMinibuffer;
 #define USE_CLASS_COMBO 1
 
 FormDocument::FormDocument(LyXView * lv, Dialogs * d)
-       : FormBase(lv, d, _("Document Layout"), BUFFER_DEPENDENT, UPDATE,
-                  new NoRepeatedApplyReadOnlyPolicy),
+       : FormBaseBD(lv, d, _("Document Layout"),
+                    new NoRepeatedApplyReadOnlyPolicy),
          dialog_(0), paper_(0), class_(0), language_(0), options_(0),
          bullets_(0), current_bullet_panel(0), current_bullet_depth(0),
          fbullet(0), combo_language(0), combo_doc_class(0)
@@ -94,6 +94,10 @@ void FormDocument::build()
     bc_.setUndoAll(dialog_->button_restore);
     bc_.refresh();
 
+    // Workaround dumb xforms sizing bug
+    minw_ = form()->w;
+    minh_ = form()->h;
+
     // the document paper form
     paper_ = build_doc_paper();
     fl_addto_choice(paper_->choice_papersize2,
@@ -146,7 +150,7 @@ void FormDocument::build()
     for (LyXTextClassList::const_iterator cit = textclasslist.begin();
         cit != textclasslist.end(); ++cit)
     {
-       combo_doc_class->addto((*cit).description().c_str());
+       combo_doc_class->addto((*cit).description());
     }
 #else
     fl_clear_choice(class_->choice_doc_class);
@@ -207,7 +211,7 @@ void FormDocument::build()
 #endif
     for(Languages::const_iterator cit = languages.begin();
        cit != languages.end(); ++cit) {
-       combo_language->addto((*cit).second.lang().c_str());
+       combo_language->addto((*cit).second.lang());
     }
 
     fl_addto_choice(language_->choice_quotes_language,
@@ -391,9 +395,9 @@ bool FormDocument::class_apply()
        params.pagestyle = fl_get_choice_text(class_->choice_doc_pagestyle);
 
 #ifdef USE_CLASS_COMBO   
-       unsigned int new_class = combo_doc_class->get() - 1;
+       unsigned int const new_class = combo_doc_class->get() - 1;
 #else
-       unsigned int new_class = fl_get_choice(class_->choice_doc_class) - 1;
+       unsigned int const new_class = fl_get_choice(class_->choice_doc_class) - 1;
 #endif
        if (params.textclass != new_class) {
                // try to load new_class
@@ -424,14 +428,14 @@ bool FormDocument::class_apply()
                                   _("Errors loading new document class."),
                                   _("Reverting to original document class."));
 #ifdef USE_CLASS_COMBO
-                       combo_doc_class->select(params.textclass + 1);
+                       combo_doc_class->select(int(params.textclass) + 1);
 #else
                        fl_set_choice(class_->choice_doc_class,
                                      params.textclass + 1);
 #endif
                }
        }
-       char tmpsep = params.paragraph_separation;
+       BufferParams::PARSEP tmpsep = params.paragraph_separation;
        if (fl_get_button(class_->radio_doc_indent))
                params.paragraph_separation = BufferParams::PARSEP_INDENT;
        else
@@ -504,8 +508,10 @@ void FormDocument::paper_apply()
 {
     BufferParams & params = lv_->buffer()->params;
     
-    params.papersize2 = fl_get_choice(paper_->choice_papersize2)-1;
-    params.paperpackage = fl_get_choice(paper_->choice_paperpackage)-1;
+    params.papersize2 =
+           static_cast<char>(fl_get_choice(paper_->choice_papersize2)-1);
+    params.paperpackage =
+           static_cast<char>(fl_get_choice(paper_->choice_paperpackage)-1);
     params.use_geometry = fl_get_button(paper_->push_use_geometry);
     if (fl_get_button(paper_->radio_landscape))
        params.orientation = BufferParams::ORIENTATION_LANDSCAPE;
@@ -621,7 +627,7 @@ void FormDocument::class_update(BufferParams const & params)
 
 #ifdef USE_CLASS_COMBO
     combo_doc_class->select_text(
-       textclasslist.DescOfClass(params.textclass).c_str());
+       textclasslist.DescOfClass(params.textclass));
 #else  
     fl_set_choice_text(class_->choice_doc_class, 
                       textclasslist.DescOfClass(params.textclass).c_str());
@@ -666,7 +672,7 @@ void FormDocument::class_update(BufferParams const & params)
     }
     fl_set_button(class_->radio_doc_sides_one, 0);
     fl_set_button(class_->radio_doc_sides_two, 0);
-    if (params.sides == 2)
+    if (params.sides == LyXTextClass::TwoSides)
        fl_set_button(class_->radio_doc_sides_two, 1);
     else
        fl_set_button(class_->radio_doc_sides_one, 1);
@@ -712,7 +718,7 @@ void FormDocument::language_update(BufferParams const & params)
     if (!language_)
         return;
 
-    combo_language->select_text(params.language->lang().c_str());
+    combo_language->select_text(params.language->lang());
     fl_set_choice_text(language_->choice_inputenc, params.inputenc.c_str());
     fl_set_choice(language_->choice_quotes_language, params.quotes_language + 1);
     fl_set_button(language_->radio_single, 0);
@@ -826,7 +832,7 @@ void FormDocument::checkMarginValues()
 bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
 {
     string str;
-    char val;
+    int val;
     bool ok = true;
     char const * input;
     
@@ -1024,7 +1030,7 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
        }
        new_panel += ".xpm";
        fl_set_bmtable_pixmap_file(bullets_->bmtable_bullet_panel, 6, 6,
-                                  LibFileSearch("images", new_panel.c_str()).c_str());
+                                  LibFileSearch("images", new_panel).c_str());
        fl_redraw_object(bullets_->bmtable_bullet_panel);
        fl_unfreeze_form(bullets_->form);
     }
@@ -1055,15 +1061,13 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
        ob = class_->choice_doc_class;
 
     ProhibitInput(lv_->view());
-    int tc;
-    string tct;
 
 #ifdef USE_CLASS_COMBO
-    tc = combo_doc_class->get() - 1;
-    tct = combo_doc_class->getline();
+    int tc = combo_doc_class->get() - 1;
+    string tct = combo_doc_class->getline();
 #else
-    tc = fl_get_choice(ob) - 1;
-    tct = fl_get_choice_text(ob);
+    int tc = fl_get_choice(ob) - 1;
+    string tct = fl_get_choice_text(ob);
 #endif
     if (textclasslist.Load(tc)) {
        if (AskQuestion(_("Should I set some parameters to"), tct,
@@ -1080,7 +1084,7 @@ void FormDocument::CheckChoiceClass(FL_OBJECT * ob, long)
                   _("Unable to switch to new document class."),
                   _("Reverting to original document class."));
 #ifdef USE_CLASS_COMBO
-       combo_doc_class->select(lv_->buffer()->params.textclass + 1);
+       combo_doc_class->select(int(lv_->buffer()->params.textclass) + 1);
 #else
        fl_set_choice(class_->choice_doc_class, 
                      lv_->buffer()->params.textclass + 1);