Ticket #3789: 3789.diff
File 3789.diff, 5.5 KB (added by , 15 years ago) |
---|
-
src/preferences/datatranslations/DataTranslationsWindow.cpp
29 29 #include <TranslationDefs.h> 30 30 #include <TranslatorRoster.h> 31 31 32 #include "Area.h" 33 #include "BALMLayout.h" 34 #include "OperatorType.h" 35 #include "XTab.h" 36 #include "YTab.h" 37 32 38 #define DTW_RIGHT 400 33 39 #define DTW_BOTTOM 300 34 40 … … 40 46 DataTranslationsWindow::DataTranslationsWindow() 41 47 : BWindow(BRect(0, 0, DTW_RIGHT, DTW_BOTTOM), 42 48 "DataTranslations", B_TITLED_WINDOW, 43 B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE )49 B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS) 44 50 { 45 51 MoveTo(dynamic_cast<DataTranslationsApplication *>(be_app)->WindowCorner()); 46 52 … … 156 162 configRect.InsetBy(3, 3); 157 163 configRect.bottom -= 45; 158 164 float width = 0, height = 0; 159 fConfigView->GetPreferredSize(&width, &height); 165 if ((fConfigView->Flags() & B_SUPPORTS_LAYOUT) != 0) { 166 BSize configSize = fConfigView->ExplicitPreferredSize(); 167 width = configSize.Width(); 168 height = configSize.Height(); 169 } else { 170 fConfigView->GetPreferredSize(&width, &height); 171 } 160 172 float widen = max_c(0, width - configRect.Width()); 161 173 float heighten = max_c(0, height - configRect.Height()); 162 174 if (widen > 0 || heighten > 0) { … … 187 199 AddChild(mainView); 188 200 189 201 // Add the translators list view 190 fTranslatorListView = new TranslatorListView(BRect( 10, 10, 120, Bounds().Height() - 10),191 "TransList", B_SINGLE_SELECTION_LIST);202 fTranslatorListView = new TranslatorListView(BRect(0, 0, 1, 1), "TransList", 203 B_SINGLE_SELECTION_LIST); 192 204 fTranslatorListView->SetSelectionMessage(new BMessage(kMsgSelectedTranslator)); 193 205 194 206 BScrollView *scrollView = new BScrollView("scroll_trans", fTranslatorListView, 195 207 B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS, 196 208 false, true, B_FANCY_BORDER); 197 mainView->AddChild(scrollView);198 209 199 210 // Box around the config and info panels 200 fRightBox = new BBox(BRect(130.0f + B_V_SCROLL_BAR_WIDTH, 8.0f, Bounds().Width() - 8.0f, 201 Bounds().Height() - 8.0f), "Right_Side", B_FOLLOW_ALL); 202 mainView->AddChild(fRightBox); 211 fRightBox = new BBox("Right_Side"); 203 212 204 213 // Add the translator icon view 205 BRect rightRect(fRightBox->Bounds()), iconRect(0, 0, 31, 31); 206 rightRect.InsetBy(8, 8); 207 iconRect.OffsetTo(rightRect.left, rightRect.bottom - iconRect.Height()); 208 fIconView = new IconView(iconRect, "Icon", 214 fIconView = new IconView(BRect(0, 0, 31, 31), "Icon", 209 215 B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW | B_FRAME_EVENTS); 210 fRightBox->AddChild(fIconView);211 216 212 217 // Add the translator info button 213 BRect infoRect(0, 0, 80, 20); 214 BButton *button = new BButton(infoRect, "STD", "Info" B_UTF8_ELLIPSIS, 215 new BMessage(kMsgTranslatorInfo), B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT, 216 B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); 217 button->ResizeToPreferred(); 218 button->MoveTo(fRightBox->Bounds().Width() - button->Bounds().Width() - 10.0f, 219 fRightBox->Bounds().Height() - button->Bounds().Height() - 10.0f); 220 fRightBox->AddChild(button); 218 BButton *button = new BButton("STD", "Info" B_UTF8_ELLIPSIS, 219 new BMessage(kMsgTranslatorInfo), B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE); 221 220 222 221 // Add the translator name view 223 BRect tranNameRect(iconRect.right + 5, iconRect.top, 224 infoRect.left - 5, iconRect.bottom); 225 fTranslatorNameView = new BStringView(tranNameRect, "TranName", "None", 226 B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); 227 fRightBox->AddChild(fTranslatorNameView); 222 fTranslatorNameView = new BStringView("TranName", "None"); 228 223 229 224 // Populate the translators list view 230 225 _PopulateListView(); 231 226 227 // Build the layout 228 BALMLayout *layout = new BALMLayout(); 229 mainView->SetLayout(layout); 230 231 XTab *x1 = layout->AddXTab(); 232 XTab *x2 = layout->AddXTab(); 233 XTab *x3 = layout->AddXTab(); 234 YTab *y1 = layout->AddYTab(); 235 236 Area *leftArea = layout->AddArea(layout->Left(), layout->Top(), 237 x1, layout->Bottom(), scrollView); 238 leftArea->SetLeftInset(10); 239 leftArea->SetTopInset(10); 240 leftArea->SetBottomInset(10); 241 242 Area *rightArea = layout->AddArea(x1, layout->Top(), layout->Right(), y1, fRightBox); 243 rightArea->SetLeftInset(10); 244 rightArea->SetTopInset(10); 245 rightArea->SetRightInset(10); 246 rightArea->SetBottomInset(10); 247 248 Area *iconArea = layout->AddArea(x1, y1, x2, layout->Bottom(), fIconView); 249 iconArea->SetLeftInset(10); 250 iconArea->SetBottomInset(10); 251 252 Area *infoButtonArea = layout->AddArea(x3, y1, layout->Right(), layout->Bottom(), button); 253 infoButtonArea->SetRightInset(10); 254 infoButtonArea->SetBottomInset(10); 255 256 layout->AddConstraint(3.0, x1, -1.0, layout->Right(), OperatorType(EQ), 0.0); 257 232 258 fTranslatorListView->MakeFocus(); 233 fTranslatorListView->Select(0 , false);259 fTranslatorListView->Select(0); 234 260 } 235 261 236 262 -
src/preferences/datatranslations/Jamfile
1 1 SubDir HAIKU_TOP src preferences datatranslations ; 2 2 3 UseLibraryHeaders lp_solve linprog alm ; 4 3 5 Preference DataTranslations : 4 6 DataTranslations.cpp 5 7 DataTranslationsWindow.cpp … … 7 9 IconView.cpp 8 10 TranslatorListView.cpp 9 11 10 : be translation 12 : be translation liblpsolve55.so liblinprog.so libalm.so 11 13 : DataTranslations.rdef 12 14 ;