@@ -1195,17 +1195,8 @@ void TextEditInput::layout(StbTexteditRow *row, int start) const {
11951195
11961196void TextEditInput::layout (int w, int h) {
11971197 if (_resizable) {
1198- if (_height == _charHeight) {
1199- _x = (w - _width) / 2 ;
1200- _y = h - (_charHeight * 2.5 );
1201- } else if (_width == _charWidth * SIDE_BAR_WIDTH) {
1202- int border = _charWidth * 2 ;
1203- _height = h - (border * 2 );
1204- _x = w - (_width + border);
1205- } else {
1206- _width = w - (_x + _xmargin);
1207- _height = h - (_y + _ymargin);
1208- }
1198+ _width = w - (_x + _xmargin);
1199+ _height = h - (_y + _ymargin);
12091200 }
12101201}
12111202
@@ -1932,7 +1923,8 @@ TextEditHelpWidget::TextEditHelpWidget(TextEditInput *editor, int chW, int chH,
19321923 _mode(kNone ),
19331924 _editor(editor),
19341925 _openPackage(nullptr ),
1935- _openKeyword(-1 ) {
1926+ _openKeyword(-1 ),
1927+ _layout(kPopup ) {
19361928 _theme = new EditTheme (HELP_FG, HELP_BG);
19371929 hide ();
19381930 if (overlay) {
@@ -2417,8 +2409,10 @@ void TextEditHelpWidget::showPopup(int cols, int rows) {
24172409 }
24182410 _x = (_editor->_width - _width) / 2 ;
24192411 if (rows == 1 ) {
2412+ _layout = kLine ;
24202413 _y = _editor->_height - (_charHeight * 2.5 );
24212414 } else {
2415+ _layout = kPopup ;
24222416 _y = (_editor->_height - _height) / 2 ;
24232417 }
24242418 _theme->contrast (_editor->getTheme ());
@@ -2433,6 +2427,7 @@ void TextEditHelpWidget::showSidebar() {
24332427 _x = _editor->_width - (_width + border);
24342428 _y = border;
24352429 _theme->contrast (_editor->getTheme ());
2430+ _layout = kSidebar ;
24362431 calcMargin ();
24372432 show ();
24382433}
@@ -2446,3 +2441,23 @@ void TextEditHelpWidget::draw(int x, int y, int w, int h, int chw) {
24462441 maFillRect (x + _width, y + shadowH, shadowW, _height);
24472442 maFillRect (x + shadowW, y + _height, _width, shadowH);
24482443}
2444+
2445+ void TextEditHelpWidget::layout (int w, int h) {
2446+ if (_resizable) {
2447+ int border;
2448+ switch (_layout) {
2449+ case kLine :
2450+ _x = (w - _width) / 2 ;
2451+ _y = h - (_charHeight * 2.5 );
2452+ break ;
2453+ case kSidebar :
2454+ border = _charWidth * 2 ;
2455+ _height = h - (border * 2 );
2456+ _x = w - (_width + border);
2457+ break ;
2458+ case kPopup :
2459+ _width = w - (_x + _xmargin);
2460+ _height = h - (_y + _ymargin);
2461+ }
2462+ }
2463+ }
0 commit comments