Bo Peng wrote:
> Please test this listings dialog, which looks more like Herbert's

Nice!
The dialog is wider than in the designer, so could
you add a spacer on the left of the style group box?


> original one. I would appreciate it if someone can show me how to call
> this dialog from Include dialog and TextLayout dialog.

>From the file import dialog?


> 
> I plan to add it before beta3.
> 
> Cheers,
> Bo
> 
> 

>               } else if (prefixIs(*it, "numbers=")) {
>                       if (contains(*it, "left") != string::npos)
>                               dialog_->numberLeftCB->setChecked(true);

What do you test here?

contains   npos                result
-----------------------------------------
false/0    !=0                  true
true/!=0   0                    true
true       !0                   it depends of the true value (mostly 1?)

is this your intention?


> +                             dialog_->numberLeftCB->setChecked(true);
> +                     else if (contains(*it, "right") != string::npos)


same here.

> +                             dialog_->numberRightCB->setChecked(true);
> +                     *it = "";
> +             } else if (prefixIs(*it, "stepnumber=")) {
> +                     dialog_->numberStepLE->setText(toqstr(it->substr(11)));
> +                     *it = "";
> +             } else if (prefixIs(*it, "numberstyle=")) {
> +                     for (vector<string>::const_iterator st = 
> fontsizes.begin();
> +                         st != fontsizes.end(); ++st) {
> +                             if (*it == "numberstyle=\\" + *st) {
> +                                     
> dialog_->numberFontSizeCO->setCurrentIndex(
> +                                             
> dialog_->numberFontSizeCO->findText(toqstr(*st)));
> +                                     *it = "";
> +                             }                       
> +                     }
> +             } else if (prefixIs(*it, "firstline=")) {
> +                     dialog_->firstlineLE->setText(toqstr(it->substr(10)));
> +                     *it = "";
> +             } else if (prefixIs(*it, "lastline=")) {
> +                     dialog_->lastlineLE->setText(toqstr(it->substr(9)));
> +                     *it = "";
> +             } else if (prefixIs(*it, "basicstyle=")) {
> +                     string style;
> +                     string size;
> +                     for (vector<string>::const_iterator st = 
> fontstyles.begin();
> +                         st != fontstyles.end(); ++st)
> +                             if (contains(*it, "\\" + *st)) {
> +                                     style = "\\" + *st;
> +                                     break;
> +                             }
> +                     for (vector<string>::const_iterator st = 
> fontsizes.begin();
> +                         st != fontsizes.end(); ++st)
> +                             if (contains(*it, "\\" + *st)) {
> +                                     size = "\\" + *st;
> +                                     break;
> +                             }
> +                     if (it->substr(11) == style + size || it->substr(11) == 
> size + style) {
> +                             if (!style.empty())
> +                                     dialog_->fontstyleCO->setCurrentIndex(
> +                                             
> dialog_->fontstyleCO->findText(toqstr(style.substr(1))));
> +                             if (!size.empty())
> +                                     dialog_->fontsizeCO->setCurrentIndex(
> +                                             
> dialog_->fontsizeCO->findText(toqstr(size.substr(1))));
> +                             *it = "";
> +                     }
> +             } else if (prefixIs(*it, "breaklines=")) {
> +                     dialog_->breaklinesCB->setChecked(prefixIs(*it, "true") 
> != string::npos);


same here.

> +                     *it = "";
> +             } else if (prefixIs(*it, "showspaces=")) {
> +                     dialog_->spaceCB->setChecked(prefixIs(*it, "true") != 
> string::npos);


same here.


> +                     *it = "";
> +             } else if (prefixIs(*it, "extendedchars=")) {
> +                     dialog_->extendedcharsCB->setChecked(prefixIs(*it, 
> "true") != string::npos);


same here.

> +                     *it = "";
> +             } else if (prefixIs(*it, "caption=")) {
> +                     string cap = it->substr(8);
> +                     if ((cap[0] == '{' && cap[cap.size()-1] == '}') ||
> +                             (cap[0] == '"' && cap[cap.size()-1] == '"') )
> +                             
> dialog_->captionLE->setText(toqstr(cap.substr(1, cap.size()-2)));
> +                     else
> +                             dialog_->captionLE->setText(toqstr(cap));       
>         
> +                     *it = "";
> +             } else if (prefixIs(*it, "label=")) {
> +                     string lbl = it->substr(6);
> +                     if ((lbl[0] == '{' && lbl[lbl.size()-1] == '}') ||
> +                             (lbl[0] == '"' && lbl[lbl.size()-1] == '"') )
> +                             dialog_->labelLE->setText(toqstr(lbl.substr(1, 
> lbl.size()-2)));
> +                     else
> +                             dialog_->labelLE->setText(toqstr(lbl));         
>         
> +                     *it = "";
> +             }
> +     }
> +     string extra = getStringFromVector(pars);
> +     
> dialog_->listingsED->setPlainText(toqstr(InsetListingsParams(extra).separatedParams()));
>  }
>  
>  


-- 
Peter Kümmel

Reply via email to