comparison libgui/graphics/EditControl.cc @ 18692:fe0e34be5576

maint: untabify recently added code files. * Backend.cc, BaseControl.cc, ButtonControl.cc, Canvas.cc, Canvas.h, CheckBoxControl.cc, Container.cc, ContextMenu.cc, EditControl.cc, Figure.cc, Figure.h, GLCanvas.h, ListBoxControl.cc, Menu.cc, MouseModeActionGroup.cc, Object.cc, Object.h, ObjectFactory.cc, ObjectProxy.cc, Panel.cc, PopupMenuControl.cc, PushButtonControl.cc, PushTool.cc, QtHandlesUtils.cc, QtHandlesUtils.h, RadioButtonControl.cc, SliderControl.cc, TextControl.cc, ToggleButtonControl.cc, ToggleTool.cc, ToolBar.cc, ToolBarButton.cc, __init_qt__.cc, pt-jit.cc, ov-classdef.cc, ov-classdef.h: Untabify code.
author Rik <rik@octave.org>
date Sun, 27 Apr 2014 18:02:47 -0700
parents fb96b7f55242
children
comparison
equal deleted inserted replaced
18691:9a6646cc7c3e 18692:fe0e34be5576
41 if (parent) 41 if (parent)
42 { 42 {
43 Container* container = parent->innerContainer (); 43 Container* container = parent->innerContainer ();
44 44
45 if (container) 45 if (container)
46 { 46 {
47 uicontrol::properties& up = Utils::properties<uicontrol> (go); 47 uicontrol::properties& up = Utils::properties<uicontrol> (go);
48 48
49 if ((up.get_max () - up.get_min ()) > 1) 49 if ((up.get_max () - up.get_min ()) > 1)
50 return new EditControl (go, new TextEdit (container)); 50 return new EditControl (go, new TextEdit (container));
51 else 51 else
52 return new EditControl (go, new QLineEdit (container)); 52 return new EditControl (go, new QLineEdit (container));
53 } 53 }
54 } 54 }
55 55
56 return 0; 56 return 0;
57 } 57 }
58 58
72 72
73 uicontrol::properties& up = properties<uicontrol> (); 73 uicontrol::properties& up = properties<uicontrol> ();
74 74
75 edit->setText (Utils::fromStdString (up.get_string_string ())); 75 edit->setText (Utils::fromStdString (up.get_string_string ()));
76 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), 76 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
77 up.get_verticalalignment ())); 77 up.get_verticalalignment ()));
78 78
79 connect (edit, SIGNAL (textEdited (const QString&)), 79 connect (edit, SIGNAL (textEdited (const QString&)),
80 SLOT (textChanged (void))); 80 SLOT (textChanged (void)));
81 connect (edit, SIGNAL (editingFinished (void)), 81 connect (edit, SIGNAL (editingFinished (void)),
82 SLOT (editingFinished (void))); 82 SLOT (editingFinished (void)));
83 } 83 }
84 84
85 EditControl::EditControl (const graphics_object& go, TextEdit* edit) 85 EditControl::EditControl (const graphics_object& go, TextEdit* edit)
86 : BaseControl (go, edit), m_multiLine (true), m_textChanged (false) 86 : BaseControl (go, edit), m_multiLine (true), m_textChanged (false)
87 { 87 {
101 edit->setAcceptRichText (false); 101 edit->setAcceptRichText (false);
102 // FIXME: support string_vector 102 // FIXME: support string_vector
103 edit->setPlainText (Utils::fromStdString (up.get_string_string ())); 103 edit->setPlainText (Utils::fromStdString (up.get_string_string ()));
104 104
105 connect (edit, SIGNAL (textChanged (void)), 105 connect (edit, SIGNAL (textChanged (void)),
106 SLOT (textChanged (void))); 106 SLOT (textChanged (void)));
107 connect (edit, SIGNAL (editingFinished (void)), 107 connect (edit, SIGNAL (editingFinished (void)),
108 SLOT (editingFinished (void))); 108 SLOT (editingFinished (void)));
109 } 109 }
110 110
111 EditControl::~EditControl (void) 111 EditControl::~EditControl (void)
112 { 112 {
113 } 113 }
127 handled = updateSingleLine (pId); 127 handled = updateSingleLine (pId);
128 128
129 if (! handled) 129 if (! handled)
130 { 130 {
131 switch (pId) 131 switch (pId)
132 { 132 {
133 default: 133 default:
134 BaseControl::update (pId); 134 BaseControl::update (pId);
135 break; 135 break;
136 } 136 }
137 } 137 }
138 } 138 }
139 139
140 bool EditControl::updateSingleLine (int pId) 140 bool EditControl::updateSingleLine (int pId)
141 { 141 {
148 edit->setText (Utils::fromStdString (up.get_string_string ())); 148 edit->setText (Utils::fromStdString (up.get_string_string ()));
149 return true; 149 return true;
150 case uicontrol::properties::ID_HORIZONTALALIGNMENT: 150 case uicontrol::properties::ID_HORIZONTALALIGNMENT:
151 case uicontrol::properties::ID_VERTICALALIGNMENT: 151 case uicontrol::properties::ID_VERTICALALIGNMENT:
152 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (), 152 edit->setAlignment (Utils::fromHVAlign (up.get_horizontalalignment (),
153 up.get_verticalalignment ())); 153 up.get_verticalalignment ()));
154 return true; 154 return true;
155 case uicontrol::properties::ID_MIN: 155 case uicontrol::properties::ID_MIN:
156 case uicontrol::properties::ID_MAX: 156 case uicontrol::properties::ID_MAX:
157 if ((up.get_max () - up.get_min ()) > 1) 157 if ((up.get_max () - up.get_min ()) > 1)
158 { 158 {
159 QWidget* container = edit->parentWidget (); 159 QWidget* container = edit->parentWidget ();
160 160
161 delete edit; 161 delete edit;
162 init (new TextEdit (container), true); 162 init (new TextEdit (container), true);
163 } 163 }
164 return true; 164 return true;
165 default: 165 default:
166 break; 166 break;
167 } 167 }
168 168
180 edit->setPlainText (Utils::fromStdString (up.get_string_string ())); 180 edit->setPlainText (Utils::fromStdString (up.get_string_string ()));
181 return true; 181 return true;
182 case uicontrol::properties::ID_MIN: 182 case uicontrol::properties::ID_MIN:
183 case uicontrol::properties::ID_MAX: 183 case uicontrol::properties::ID_MAX:
184 if ((up.get_max () - up.get_min ()) <= 1) 184 if ((up.get_max () - up.get_min ()) <= 1)
185 { 185 {
186 QWidget* container = edit->parentWidget (); 186 QWidget* container = edit->parentWidget ();
187 187
188 delete edit; 188 delete edit;
189 init (new QLineEdit (container), true); 189 init (new QLineEdit (container), true);
190 } 190 }
191 return true; 191 return true;
192 default: 192 default:
193 break; 193 break;
194 } 194 }
195 195
204 void EditControl::editingFinished (void) 204 void EditControl::editingFinished (void)
205 { 205 {
206 if (m_textChanged) 206 if (m_textChanged)
207 { 207 {
208 QString txt = (m_multiLine 208 QString txt = (m_multiLine
209 ? qWidget<TextEdit> ()->toPlainText () 209 ? qWidget<TextEdit> ()->toPlainText ()
210 : qWidget<QLineEdit> ()->text ()); 210 : qWidget<QLineEdit> ()->text ());
211 211
212 gh_manager::post_set (m_handle, "string", Utils::toStdString (txt), false); 212 gh_manager::post_set (m_handle, "string", Utils::toStdString (txt), false);
213 gh_manager::post_callback (m_handle, "callback"); 213 gh_manager::post_callback (m_handle, "callback");
214 214
215 m_textChanged = false; 215 m_textChanged = false;