bool CMainWindow::RegisterAndCreateWindow() { WNDCLASSEX wcx; // Fill in the window class structure with default parameters wcx.cbSize = sizeof(WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = CWindow::stWinMsgHandler; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hResource; wcx.hCursor = NULL; ResString clsname(hResource, IDS_APP_TITLE); wcx.lpszClassName = clsname; wcx.hIcon = LoadIcon(hResource, MAKEINTRESOURCE(IDI_TORTOISEUDIFF)); wcx.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); wcx.lpszMenuName = MAKEINTRESOURCE(IDC_TORTOISEUDIFF); wcx.hIconSm = LoadIcon(wcx.hInstance, MAKEINTRESOURCE(IDI_TORTOISEUDIFF)); if (RegisterWindow(&wcx)) { if (Create(WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX | WS_SYSMENU | WS_CLIPCHILDREN, NULL)) { m_FindBar.SetParent(*this); m_FindBar.Create(hResource, IDD_FINDBAR, *this); UpdateWindow(*this); return true; } } return false; }
ErrorMessage DirectXEngine::Initialize(Jamgine::Data_Send p_data) { ErrorMessage l_errorMessage = J_OK; m_hInstance = p_data.hInstance; m_clientWidth = p_data.clientWidth; m_clientHeight = p_data.clientHeight; // Register window l_errorMessage = RegisterWindow(p_data); if(l_errorMessage != J_OK) return J_FAIL; // Init swapchain and device l_errorMessage = InitializeSwapChain(); if(l_errorMessage != J_OK) return J_FAIL; // Create texturemanger l_errorMessage = Texture2DManager::CreateTexture2DManager(&m_texture2DManager); m_texture2DManager->Initialize(m_device); if(l_errorMessage != J_OK) return J_FAIL; CreateDepthBuffer(); InitializeRenderTarget(); LoadShaders(); CreateBuffer(); SetViewport(); CreateRasterizers(); SetBlendState(); return l_errorMessage; }
/** * @param id Id of platform with launcher to control * @param idx Launcher idx on platform */ tcLauncherPopup::tcLauncherPopup(long id, unsigned idx, const wxPoint& pos) : tc3DWindow2(parent, pos, wxSize(200, 150), "LauncherPopupControl", parent), platformId(id), launcherIdx(idx), redraw(true), dragOn(false) { SetBaseRenderBin(parent->GetBaseRenderBin() + 10); tc3DWindow2::MoveToTop(); birthCount = tcTime::Get()->Get30HzCount(); simState = tcSimState::Get(); wxASSERT(simState); const int closeButtonSize = 12; closeButton = new tcButton(this, wxPoint(mnWidth - closeButtonSize, 0), wxSize(closeButtonSize, closeButtonSize)); closeButton->SetActive(true); closeButton->SetBackgroundAlpha(1.0); closeButton->SetCaption(""); closeButton->SetCommand(LP_CLOSE); closeButton->LoadImages("close.png", "close.png", "close.png", "close.png"); closeButton->SetSendRedraw(true); InitTorpedoControls(); RegisterWindow(id, idx); SetActive(true); SetBorderDraw(true); }
void FinishEditWindow(PWINDOW_EDIT pEdit,int bEnableEdit,int bCentered,int bUseHZK,char * szData){ PWINDOW_SHOW_BOX pShowBox; pShowBox = (PWINDOW_SHOW_BOX)malloc(sizeof(WINDOW_SHOW_BOX)); memset(pShowBox,0,sizeof(WINDOW_SHOW_BOX)); pShowBox -> wBasic . wtWindowType = WINDOW_TYPE_SHOW_BOX; pShowBox -> wBasic.rRectOffset.nLeft = pEdit->wBasic.rRectOffset.nLeft + pEdit->wBasic.nOutLineWidth * 2 + pEdit -> nTitleAreaWidth; pShowBox -> wBasic.rRectOffset.nWidth = pEdit->wBasic.rRectOffset.nWidth - pEdit->wBasic.nOutLineWidth * 3 - pEdit -> nTitleAreaWidth; pShowBox -> wBasic.rRectOffset.nTop = pEdit->wBasic.rRectOffset.nTop + pEdit->wBasic.nOutLineWidth; pShowBox -> wBasic.rRectOffset.nHeight = pEdit->wBasic.rRectOffset.nHeight - 2 * pEdit->wBasic.nOutLineWidth; pShowBox-> szBuffer = (char *)malloc(SHOW_BOX_BUFFER_SIZE); memset(pShowBox-> szBuffer,0,SHOW_BOX_BUFFER_SIZE ); if(szData){ strcpy(pShowBox-> szBuffer,szData); } pShowBox-> bEnableEdit =bEnableEdit; pShowBox-> bCentered =bCentered ; pShowBox-> bUseHZK =bUseHZK ; pShowBox-> nFrontSize =pEdit->nFrontSize; pShowBox-> wBasic.mhFunctions[EVENT_ON_CLICK] = ShowBoxOnClick; pShowBox-> wBasic.mhFunctions[EVENT_TIME_TICK] = ShowBoxOnTimer; pShowBox-> wBasic.mhFunctions[EVENT_ON_KEY] = ShowBoxOnKey; pShowBox-> wBasic.mhFunctions[EVENT_LOST_FOCUS] = ShowBoxLostFocus; pShowBox-> wBasic.mhFunctions[EVENT_ON_HZ] = ShowBoxOnHz; RegisterWindow((PWINDOW)pShowBox,(PWINDOW)pEdit); }
Window* WindowManager::CreateWindow(int width, int height, void (*handlectrlr)(int mouseX, int mouseY, int btn), void (*render)(void), void (*handleDstry)(void), char * name, int transparent) { Window* w = new Window(); w->Screen = Graphics::CreateImage(width, height); w->Topbar = InitTopbar(width, name); w->Width = width; w->Height = height + w->Topbar->imageHeight; w->X = createdLastX; w->Y = createdLastY; w->ContentX = w->X; w->ContentY = w->Y + w->Topbar->imageHeight; w->Handle = handlectrlr; w->Destroy = handleDstry; w->Transparent = transparent; w->Fullscreen = 0; w->Borders = 1; w->Enabled = 1; w->Render = render; RegisterWindow(w); createdLastX += 20; createdLastY += 10; return w; }
bool CMainWindow::RegisterAndCreateWindow() { WNDCLASSEX wcx; // Fill in the window class structure with default parameters wcx.cbSize = sizeof(WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = CWindow::stWinMsgHandler; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hResource; wcx.hCursor = LoadCursor(NULL, IDC_SIZEWE); ResString clsname(hResource, IDS_APP_TITLE); wcx.lpszClassName = clsname; wcx.hIcon = LoadIcon(hResource, MAKEINTRESOURCE(IDI_TORTOISEIDIFF)); wcx.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); if (selectionPaths.empty()) wcx.lpszMenuName = MAKEINTRESOURCE(IDC_TORTOISEIDIFF); else wcx.lpszMenuName = MAKEINTRESOURCE(IDC_TORTOISEIDIFF2); wcx.hIconSm = LoadIcon(wcx.hInstance, MAKEINTRESOURCE(IDI_TORTOISEIDIFF)); if (RegisterWindow(&wcx)) { if (Create(WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_VISIBLE, NULL)) { UpdateWindow(m_hwnd); return true; } } return false; }
void Window::Init(const WindowParam& param) { WNDCLASSEX wndClass(param.wndClass); wndClass.lpfnWndProc = WndProc; wndClass.lpszClassName = param.wndClass_className.get(); if(!RegisterClassEx(&wndClass)) throw WIN32EXCEPTION_1("RegisterClassEx"); _parentHwnd = param.hWndParent; _clientAreaAsCaption = param.clientAreaAsCaption; _hwnd = CreateWindowEx( param.exStyle, wndClass.lpszClassName, param.caption.get(), param.style, param.x, param.y, param.width, param.height, param.hWndParent, param.hMenu, wndClass.hInstance, param.lpParam); if(!_hwnd) throw WIN32EXCEPTION_1("CreateWindow"); RegisterWindow(*this); onCreate(*this); }
void GlobalContext::InsertMarkedWindows() { graphics::GLWindow::Event event; for (auto window : windows_marked_for_insertion) { RegisterWindow(window); event.type = graphics::GLWindow::Event::WINDOW_OPEN; window->OnEvent(event); } windows_marked_for_insertion.clear(); }
bool CreateNewWindow() { HWND hWnd = CreateNewWindow_impl(); m_hWnd = hWnd; if (hWnd != INVALID_HANDLE_VALUE) { RegisterWindow(hWnd, this); ResetTimer(); InitOpenGL(hWnd); return true; } return false; }
void FinishIMEWindow(PWINDOW_IME pIME) { PWINDOW_SHOW_BOX pShowBox; pIME->wBasic.wtWindowType = WINDOW_TYPE_IME; pIME -> wBasic.rAbsolute.nLeft = 0; pIME -> wBasic.rAbsolute.nWidth =1024; pIME -> wBasic.rAbsolute.nTop = 0; pIME -> wBasic.rAbsolute.nHeight = 50; pIME -> wBasic.rRectOffset.nLeft = 0; pIME -> wBasic.rRectOffset.nWidth = 0; pIME -> wBasic.rRectOffset.nTop = 0; pIME -> wBasic.rRectOffset.nHeight = 0; pIME -> wBasic.nOutLineWidth = 5; pIME -> szKeys = (char*)malloc(SHOW_BOX_BUFFER_SIZE); pIME -> szHz = (char*)malloc(SHOW_BOX_BUFFER_SIZE); memset(pIME -> szKeys,0,SHOW_BOX_BUFFER_SIZE); memset(pIME -> szHz ,0,SHOW_BOX_BUFFER_SIZE); pIME -> bShowHZ = 0; pShowBox = (PWINDOW_SHOW_BOX)malloc(sizeof(WINDOW_SHOW_BOX)); memset(pShowBox,0,sizeof(WINDOW_SHOW_BOX)); pShowBox -> wBasic . wtWindowType = WINDOW_TYPE_SHOW_BOX; pShowBox -> wBasic.rRectOffset.nLeft = pIME->wBasic.rRectOffset.nLeft + pIME->wBasic.nOutLineWidth * 2; pShowBox -> wBasic.rRectOffset.nWidth = pIME->wBasic.rAbsolute.nWidth - pIME->wBasic.nOutLineWidth *2; pShowBox -> wBasic.rRectOffset.nTop = pIME->wBasic.rRectOffset.nTop + pIME->wBasic.nOutLineWidth; pShowBox -> wBasic.rRectOffset.nHeight = pIME->wBasic.rAbsolute.nHeight - 2 * pIME->wBasic.nOutLineWidth; pShowBox-> szBuffer = (char *)malloc(SHOW_BOX_BUFFER_SIZE); memset(pShowBox-> szBuffer,0,SHOW_BOX_BUFFER_SIZE ); pShowBox-> nFrontSize =pIME->nFrontSize; pShowBox-> bEnableEdit =0 ; pShowBox-> bCentered =0 ; pShowBox-> bUseHZK =0 ; pIME -> wBasic.mhFunctions[EVENT_ON_KEY] = IMEWindowOnKey; pIME -> wBasic.mhFunctions[EVENT_LOST_FOCUS] = IMELostFocus; pShowBox-> wBasic.mhFunctions[EVENT_ON_CLICK] = ShowBoxOnClick; pShowBox-> wBasic.mhFunctions[EVENT_TIME_TICK] = ShowBoxOnTimer; pShowBox-> wBasic.mhFunctions[EVENT_ON_KEY] = ShowBoxOnKey; pShowBox-> wBasic.mhFunctions[EVENT_LOST_FOCUS] = ShowBoxLostFocus; RegisterWindow((PWINDOW)pShowBox,(PWINDOW)pIME); }
static void RecvPanda( ScreenData *scr, NETFILE *fp) { char old_window[SIZE_NAME+1]; int i; ENTER_FUNC; strncpy(old_window,scr->window,SIZE_NAME); old_window[SIZE_NAME] = 0; if (RecvTermServerHeader(fp,scr)) { ON_IO_ERROR(fp,badio); if (scr->Windows != NULL) { g_hash_table_foreach(scr->Windows,(GHFunc)ClearPutType,NULL); } dbgprintf("type = [%d]",type); dbgprintf("ThisWindow [%s]",old_window); dbgprintf("window [%s]",scr->window); dbgprintf("user = [%s]",scr->user); for (i=0;i<scr->w.sp;i++) { if (scr->w.s[i].puttype == SCREEN_CLOSE_WINDOW) { RegisterWindow(scr,scr->w.s[i].window); PutWindow(scr,scr->w.s[i].window,SCREEN_CLOSE_WINDOW); scr->w.s[i].puttype = SCREEN_NULL; } } if (RegisterWindow(scr,scr->window) != NULL) { PutWindow(scr,scr->window,scr->puttype); RecvTermServerData(fp,scr); ON_IO_ERROR(fp,badio); } else { scr->status = SCREEN_DATA_NULL; /*glserver exit*/ } } else { Error("invalid LD; window = [%s]",scr->window); } LEAVE_FUNC; return; badio: Warning("badio"); exit(1); }
CVisioFrameWnd* CAddinApp::ShowShapeSheetWatchWindow(IVWindowPtr window, bool show) { CVisioFrameWnd* wnd = GetWindowShapeSheet(window); if ((wnd != NULL) == show) return wnd; if (wnd) { wnd->Destroy(); RegisterWindow(window, NULL); return NULL; } else { wnd = new CVisioFrameWnd(); wnd->Create(window); RegisterWindow(window, wnd); return wnd; } }
//--------------------------------------------------- bool Window::Show(const bool p_bDisplay) { if(!m_bRegistered && !RegisterWindow()) return false; if(!m_bCreated && !Create()) return false; ShowWindow(m_hWnd, p_bDisplay); UpdateWindow(m_hWnd); return true; }
bool CMainWindow::RegisterAndCreateWindow() { WNDCLASSEX wcx; // Fill in the window class structure with default parameters wcx.cbSize = sizeof(WNDCLASSEX); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = CWindow::stWinMsgHandler; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = hResource; wcx.hCursor = NULL; ResString clsname(hResource, IDS_APP_TITLE); wcx.lpszClassName = clsname; wcx.hIcon = LoadIcon(hResource, MAKEINTRESOURCE(IDI_AACLR)); wcx.hbrBackground = NULL; wcx.lpszMenuName = NULL; wcx.hIconSm = LoadIcon(wcx.hInstance, MAKEINTRESOURCE(IDI_AACLR)); if (RegisterWindow(&wcx)) { if (CreateEx(NULL, WS_POPUP, NULL)) { // On Vista, the message TasbarCreated may be blocked by the message filter. // We try to change the filter here to get this message through. If even that // fails, then we can't do much about it and the task bar icon won't show up again. HMODULE hLib = LoadLibrary(_T("user32.dll")); if (hLib) { m_pChangeWindowMessageFilter = (CMainWindow::PFNCHANGEWINDOWMESSAGEFILTEREX)GetProcAddress(hLib, "ChangeWindowMessageFilterEx"); if (m_pChangeWindowMessageFilter) { (*m_pChangeWindowMessageFilter)(m_hwnd, WM_TASKBARCREATED, MSGFLT_ALLOW, NULL); (*m_pChangeWindowMessageFilter)(m_hwnd, WM_SETTINGCHANGE, MSGFLT_ALLOW, NULL); } } ShowTrayIcon(); return true; } } return false; }
wxDragResult wxDropSource::DoDragDrop( int WXUNUSED(flags) ) { // wxASSERT_MSG( m_data, "wxDragSource: no data" ); return wxDragNone; #if 0 if (!m_data) return (wxDragResult) wxDragNone; if (m_data->GetDataSize() == 0) return (wxDragResult) wxDragNone; RegisterWindow(); // TODO UnregisterWindow(); g_blockEventsOnDrag = false; return m_retValue; #endif }
BOOL Window::RegisterWindow() { WNDCLASS wcx; // Fill in the window class structure with default parameters wcx.style = CS_HREDRAW | CS_VREDRAW; // redraw if size changes wcx.lpfnWndProc = Window::stWinMsgHandler; // points to window procedure wcx.cbClsExtra = 0; // no extra class memory wcx.cbWndExtra = 0; // no extra window memory wcx.hInstance = _hInstance; // handle to instance wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION); // predefined app. icon wcx.hCursor = LoadCursor(NULL, IDC_ARROW); // predefined arrow wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // white background brush wcx.lpszMenuName = NULL; // name of menu resource wcx.lpszClassName = _T("BaseWindow"); // name of window class // Register the window class. return RegisterWindow(&wcx); }
BOOL Window::RegisterWindow(UINT style, HICON hIcon, HCURSOR hCursor, HBRUSH hbrBackground, LPCTSTR lpszMenuName, LPCTSTR lpszClassName) { WNDCLASS wcx; // Fill in the window class structure with default parameters wcx.style = style; // redraw if size changes wcx.lpfnWndProc = Window::stWinMsgHandler; // points to window procedure wcx.cbClsExtra = 0; // no extra class memory wcx.cbWndExtra = 0; // no extra window memory wcx.hInstance = _hInstance; // handle to instance wcx.hIcon = hIcon; // predefined app. icon wcx.hCursor = hCursor; // predefined arrow wcx.hbrBackground = hbrBackground; // white background brush wcx.lpszMenuName = lpszMenuName; // name of menu resource wcx.lpszClassName = lpszClassName; // name of window class // Register the window class. return RegisterWindow(&wcx); }
bool WGLWindow::initWindow() { DWORD dwStyle = WS_OVERLAPPEDWINDOW; DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Adjust window to true requested size RECT windowRect; windowRect.left = pLeft; windowRect.right = (long)pWidth; windowRect.top = pTop; windowRect.bottom = (long)pHeight; ::AdjustWindowRectEx(&windowRect, dwStyle, false, dwExStyle); // Create the window if (!(pHWnd = ::CreateWindowEx( dwExStyle, L"OpenGL", WString{pTitle}.c_str(), dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, pLeft, pTop, // Position windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, // Dimensions nullptr, nullptr, pHInstance, nullptr))) { std::cerr << "Window init error : Window creation failed !" << std::endl; std::cerr << "Error : \"" << GetLastError() << "\"" << std::endl; kill(); return false; } RegisterWindow(pHWnd, this); // Get the Device Context if (!(pHDC = ::GetDC(pHWnd))) { std::cerr << "Window init error : Can't create a Device Context !" << std::endl; kill(); return false; } const ::PIXELFORMATDESCRIPTOR pfd = { // Size (WORD)sizeof (::PIXELFORMATDESCRIPTOR), // Version 1, // Flags PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_GENERIC_ACCELERATED, // Pixel Type PFD_TYPE_RGBA, // Color depth (BYTE)pBitDepth, // Color bits ignored 0, 0, 0, 0, 0, 0, // No alpha buffer 0, // Shift bit ignored 0, // No accumulation buffer 0, // Accumulation bits ignored 0, 0, 0, 0, // 24-bit Z-buffer (Depth Buffer) 24, // 8-bit stencil buffer 8, // No auxiliary buffer 0, // Main drawing layer PFD_MAIN_PLANE, // Reserved 0, // Layer masks ignored 0, 0, 0 }; // Try MSAA init if (pHasMSAASupport && pMultiSampling != MultiSampling::msNone) { if (!initMultisamplePixelFormat(pfd, true)) { // If MSAA init failed, set the requested multisampling to none pMultiSampling = MultiSampling::msNone; initDefaultPixelFormat(pfd); // Should work, since it worked once before } } else { // Dummy format to create a GL context if (!initDefaultPixelFormat(pfd)) { std::cerr << "Window init error : Can't set pixel format !" << std::endl; kill(); return false; } } // Create a Rendering Context if necessary if (!(pHRC = ::wglCreateContext(pHDC))) { std::cerr << "Window init error : Can't create a GL rendering context !" << std::endl; kill(); return false; } // Activate the Rendering Context if (!::wglMakeCurrent(pHDC, pHRC)) { std::cerr << "Window init error : Can't activate the GL rendering context !" << std::endl; kill(); return false; } // Initialize our newly created GL window if (!GLWindow::initialize()) { std::cerr << "OpenGL Initialization Failed !" << std::endl; kill(); return false; } if (!pHasMSAASupport && pMultiSampling != MultiSampling::msNone && initMultisamplePixelFormat(pfd, false)) { pHasMSAASupport = true; closeWindowForReinit(); ::wglDeleteContext(pHRC); initWindow(); } // On success, enable multisampling if (pHasMSAASupport && pMultiSampling != MultiSampling::msNone) ::glEnable(GL_MULTISAMPLE); else ::glDisable(GL_MULTISAMPLE); // Show the window ::ShowWindow(pHWnd,SW_SHOW); // Slightly higher priority ::SetForegroundWindow(pHWnd); // Sets keyboard focus to the window ::SetFocus(pHWnd); // Set up our perspective GL screen internalResize(pWidth, pHeight); TRACKMOUSEEVENT tme; tme.cbSize = (DWORD)sizeof(TRACKMOUSEEVENT); tme.dwFlags = TME_LEAVE | TME_HOVER; tme.hwndTrack = pHWnd; tme.dwHoverTime = HOVER_DEFAULT; ::TrackMouseEvent(&tme); if (pFullScreen) { if (!enableFullScreen()) pFullScreen = false; } return true; }
TemplateWindow::TemplateWindow(const BRect& frame) : BWindow(frame, TR("Choose a project type"), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { RegisterWindow(); CheckTemplates(); DPath templatePath(gAppPath.GetFolder()); templatePath << TR("Templates"); fTempList.ScanFolder(templatePath.GetFullPath()); // project type BPopUpMenu* projectTypeMenu = new BPopUpMenu("Project type"); for (int32 i = 0; i < fTempList.CountTemplates(); i++) { ProjectTemplate* ptemp = fTempList.TemplateAt(i); entry_ref ref = ptemp->GetRef(); projectTypeMenu->AddItem(new BMenuItem(ref.name, new BMessage(M_TEMPLATE_SELECTED))); } projectTypeMenu->ItemAt(0L)->SetMarked(true); fTemplateField = new BMenuField("templatefield", TR("Project type: "), projectTypeMenu); fTemplateField->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); // project name fNameBox = new AutoTextControl("namebox", TR("Project name:"), "", new BMessage(M_NAME_CHANGED)); SetToolTip(fNameBox, TR("The name of your project. " "It can be the same as the Target name, but it does not have to be.")); // target name fTargetBox = new AutoTextControl("targetbox", TR("Target name:"), "BeApp", new BMessage(M_TARGET_CHANGED)); SetToolTip(fTargetBox, TR("The name of the compiled application or library")); // project path fPathBox = new PathBox("pathbox", gProjectPath.GetFullPath(), ""); fPathBox->SetExplicitMinSize(BSize(be_plain_font->StringWidth("M") * 36, B_SIZE_UNSET)), SetToolTip(fPathBox, TR("Set the location for your project.")); // source control BPopUpMenu* scmMenu = new BPopUpMenu("SCM Chooser"); scmMenu->AddItem(new BMenuItem(TR("Mercurial"), new BMessage())); scmMenu->AddItem(new BMenuItem(TR("Git"), new BMessage())); scmMenu->AddItem(new BMenuItem(TR("Subversion"), new BMessage())); scmMenu->AddItem(new BMenuItem(TR("None"), new BMessage())); if (!gHgAvailable) { scmMenu->ItemAt(0)->SetEnabled(false); scmMenu->ItemAt(0)->SetLabel(TR("Mercurial unavailable")); } if (!gGitAvailable) { scmMenu->ItemAt(1)->SetEnabled(false); scmMenu->ItemAt(1)->SetLabel(TR("Git unavailable")); } if (!gSvnAvailable) { scmMenu->ItemAt(2)->SetEnabled(false); scmMenu->ItemAt(2)->SetLabel(TR("Subversion unavailable")); } fSCMChooser = new BMenuField("scmchooser", TR("Source control: "), scmMenu); fSCMChooser->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetToolTip(fSCMChooser, TR("Choose the source control manager for your project, if any.")); scmMenu->ItemAt(gDefaultSCM)->SetMarked(true); BMenuItem* item = scmMenu->FindMarked(); if (!item->IsEnabled()) { item->SetMarked(false); for (int32 i = 0; i < scmMenu->CountItems(); i++) { if (scmMenu->ItemAt(i)->IsEnabled()) { scmMenu->ItemAt(i)->SetMarked(true); break; } } } // create folder check box fCreateFolder = new BCheckBox(TR("Create project folder")); fCreateFolder->SetValue(B_CONTROL_ON); SetToolTip(fCreateFolder, TR("If checked, a folder for your project will be created " "in the folder in the Location box above.")); // create project button fCreateProjectButton = new BButton("ok", TR("Create project") B_UTF8_ELLIPSIS, new BMessage(M_CREATE_PROJECT)); fCreateProjectButton->SetEnabled(false); fCreateProjectButton->MakeDefault(true); // layout BLayoutBuilder::Group<>(this, B_VERTICAL) .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(fTemplateField->CreateLabelLayoutItem(), 0, 0) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING, 1, 0) .Add(fTemplateField->CreateMenuBarLayoutItem()) .AddGlue() .End() .Add(fNameBox->CreateLabelLayoutItem(), 0, 1) .Add(fNameBox->CreateTextViewLayoutItem(), 1, 1) .Add(fTargetBox->CreateLabelLayoutItem(), 0, 2) .Add(fTargetBox->CreateTextViewLayoutItem(), 1, 2) .Add(new BStringView("location", TR("Location:")), 0, 3) .Add(fPathBox, 1, 3) .Add(fSCMChooser->CreateLabelLayoutItem(), 0, 4) .AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING, 1, 4) .Add(fSCMChooser->CreateMenuBarLayoutItem()) .AddGlue() .End() .Add(fCreateFolder, 1, 5) .End() .AddGlue() .AddGroup(B_HORIZONTAL) .AddGlue() .Add(fCreateProjectButton) .End() .SetInsets(B_USE_DEFAULT_SPACING) .End(); fNameBox->MakeFocus(true); CenterOnScreen(); }
TemplateWindow::TemplateWindow(const BRect &frame) : DWindow(frame,TR("Choose a Project Type"),B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_V_RESIZABLE) { RegisterWindow(); MakeCenteredOnShow(true); CheckTemplates(); DPath templatePath(gAppPath.GetFolder()); templatePath << TR("Templates"); fTempList.ScanFolder(templatePath.GetFullPath()); BView *top = GetBackgroundView(); if (Bounds().Height() < 100) ResizeTo(Bounds().Width(),100); if (Bounds().Width() < 100) ResizeTo(100,Bounds().Height()); BRect r(Bounds()); BRect bounds(r); float divider = be_plain_font->StringWidth(TR("Source Control:")) + 5.0; BMenu *menu = new BMenu("Project Type"); for (int32 i = 0; i < fTempList.CountTemplates(); i++) { ProjectTemplate *ptemp = fTempList.TemplateAt(i); entry_ref ref = ptemp->GetRef(); menu->AddItem(new BMenuItem(ref.name,new BMessage(M_TEMPLATE_SELECTED))); } menu->SetRadioMode(true); menu->SetLabelFromMarked(true); menu->ItemAt(0L)->SetMarked(true); font_height fh; be_plain_font->GetHeight(&fh); float fontHeight = fh.ascent + fh.descent + fh.leading; r.bottom = MAX(fontHeight,20.0); r.OffsetBy(10,10); fTemplateField = new BMenuField(r,"templatefield",TR("Project Type: "), menu); fTemplateField->SetDivider(be_plain_font->StringWidth(TR("Project Type:")) + 5); top->AddChild(fTemplateField); // controls for the options for all project types r.OffsetBy(0,r.IntegerHeight() + 10); fNameBox = new AutoTextControl(r,"namebox",TR("Project Name:"),NULL, new BMessage(M_NAME_CHANGED), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); top->AddChild(fNameBox); fNameBox->ResizeToPreferred(); r.bottom = r.top + fNameBox->Bounds().Height(); fNameBox->ResizeTo(bounds.Width() - 20.0,r.Height()); fNameBox->SetDivider(divider); SetToolTip(fNameBox, "The name of your project. It can be the same as the Target Name, " "but it does not have to be."); r.OffsetBy(0,r.IntegerHeight() + 10); fTargetBox = new AutoTextControl(r,"targetbox",TR("Target Name:"),"BeApp", new BMessage(M_TARGET_CHANGED), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); top->AddChild(fTargetBox); fTargetBox->ResizeToPreferred(); r.bottom = r.top + fTargetBox->Bounds().Height(); fTargetBox->ResizeTo(bounds.Width() - 20.0,r.Height()); fTargetBox->SetDivider(divider); SetToolTip(fTargetBox, "The name of the compiled application or library"); if (!BEntry(PROJECT_PATH).Exists()) create_directory(PROJECT_PATH,0777); r.OffsetBy(0,r.Height() + 10); fPathBox = new PathBox(r,"pathbox",gProjectPath.GetFullPath(),TR("Location:"), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); top->AddChild(fPathBox); fPathBox->ResizeToPreferred(); r.bottom = r.top + fPathBox->Bounds().Height(); fPathBox->ResizeTo(bounds.Width() - 20.0,r.Height()); fPathBox->SetDivider(divider); SetToolTip(fPathBox, "Set the location for your project."); menu = new BMenu("SCM Chooser"); menu->AddItem(new BMenuItem("Mercurial", new BMessage())); menu->AddItem(new BMenuItem("Git", new BMessage())); menu->AddItem(new BMenuItem("Subversion", new BMessage())); menu->AddItem(new BMenuItem("None", new BMessage())); if (!gHgAvailable) { menu->ItemAt(0)->SetEnabled(false); menu->ItemAt(0)->SetLabel("Mercurial Unavailable"); } if (!gGitAvailable) { menu->ItemAt(1)->SetEnabled(false); menu->ItemAt(1)->SetLabel("Git Unavailable"); } if (!gSvnAvailable) { menu->ItemAt(2)->SetEnabled(false); menu->ItemAt(2)->SetLabel("Subversion Unavailable"); } r.OffsetBy(0,r.Height() + 5.0); fSCMChooser = new BMenuField(r, "scmchooser", "Source Control: ", menu); top->AddChild(fSCMChooser); fSCMChooser->SetDivider(divider); SetToolTip(fSCMChooser, "Choose the source control manager for your project, if any."); menu->SetLabelFromMarked(true); menu->ItemAt(gDefaultSCM)->SetMarked(true); BMenuItem *item = menu->FindMarked(); if (!item->IsEnabled()) { item->SetMarked(false); for (int32 i = 0; i < menu->CountItems(); i++) { if (menu->ItemAt(i)->IsEnabled()) { menu->ItemAt(i)->SetMarked(true); break; } } } menu->SetLabelFromMarked(true); r.OffsetBy(0,r.Height() + 5.0); fCreateFolder = new BCheckBox(r,"createfolder",TR("Create Project Folder"),NULL); fCreateFolder->MoveTo(divider + 10.0, r.top); fCreateFolder->SetValue(B_CONTROL_ON); top->AddChild(fCreateFolder); SetToolTip(fCreateFolder, "If checked, a folder for your project will be created " "in the folder in the Location box above."); r.OffsetBy(0,r.Height() + 5.0); fOK = new BButton(r,"ok",TR("Create Project…"), new BMessage(M_CREATE_PROJECT)); fOK->ResizeToPreferred(); top->AddChild(fOK); fOK->SetEnabled(false); fOK->MakeDefault(true); float offset = fPathBox->Divider(); fOK->MoveBy(offset,0); float minwidth = Bounds().Width(); float minheight = fOK->Frame().bottom + 10.0; SetSizeLimits(minwidth,30000,minheight,30000); gSettings.Lock(); BRect savedframe; if (gSettings.FindRect("template_frame",&savedframe) == B_OK) ResizeTo(savedframe.Width(),savedframe.Height()); else ResizeTo(minwidth,minheight); gSettings.Unlock(); fNameBox->MakeFocus(true); }
ProjectWindow::ProjectWindow(BRect frame, Project *project) : DWindow(frame, "Paladin", B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK), fErrorWindow(NULL), fFilePanel(NULL), fProject(project), fSourceControl(NULL), fShowingLibs(false), fMenusLocked(false), fBuilder(BMessenger(this)) { AddCommonFilter(new AltTabFilter()); SetSizeLimits(200,30000,200,30000); RegisterWindow(); // This is for our in-program debug menu which comes in handy now and then. // Paladin -d doesn't always get the job done AddShortcut('9', B_COMMAND_KEY | B_SHIFT_KEY | B_CONTROL_KEY, new BMessage(M_TOGGLE_DEBUG_MENU)); if (fProject) { fSourceControl = GetSCM(fProject->SourceControl()); if (fSourceControl) { if (gPrintDebugMode > 0) fSourceControl->SetDebugMode(true); fSourceControl->SetUpdateCallback(SCMOutputCallback); fSourceControl->SetWorkingDirectory(fProject->GetPath().GetFolder()); if (fSourceControl->NeedsInit(fProject->GetPath().GetFolder())) fSourceControl->CreateRepository(fProject->GetPath().GetFolder()); } } BView *top = GetBackgroundView(); BRect bounds(Bounds()); BRect r(bounds); r.bottom = 16; fMenuBar = new BMenuBar(r,"documentbar"); top->AddChild(fMenuBar); r = bounds; r.top = fMenuBar->Frame().bottom + 1; r.right -= B_V_SCROLL_BAR_WIDTH; r.bottom -= B_H_SCROLL_BAR_HEIGHT; fProjectList = new ProjectList(fProject, r,"filelist",B_FOLLOW_ALL); fProjectList->SetInvocationMessage(new BMessage(M_EDIT_FILE)); BScrollView *scrollView = new BScrollView("scrollView",fProjectList, B_FOLLOW_ALL,0,false,true); top->AddChild(scrollView); fProjectList->SetTarget(this); r.top = r.bottom + 1; r.bottom = Bounds().bottom; fStatusBar = new BStringView(r,"statusbar", NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM); top->AddChild(fStatusBar); fStatusBar->SetViewColor(235,235,235); fStatusBar->SetFontSize(10.0); SetupMenus(); if (project) { BString title("Paladin: "); title << project->GetName(); SetTitle(title.String()); for (int32 i = 0; i < project->CountGroups(); i++) { SourceGroup *group = project->GroupAt(i); SourceGroupItem *groupitem = new SourceGroupItem(group); fProjectList->AddItem(groupitem); groupitem->SetExpanded(group->expanded); for (int32 j = 0; j < group->filelist.CountItems(); j++) { SourceFile *file = group->filelist.ItemAt(j); SourceFileItem *fileitem = new SourceFileItem(file,1); // fProjectList->AddUnder(fileitem,groupitem); fProjectList->AddItem(fileitem); BString abspath = file->GetPath().GetFullPath(); if (abspath[0] != '/') { abspath.Prepend("/"); abspath.Prepend(project->GetPath().GetFolder()); } BEntry entry(abspath.String()); if (entry.Exists()) { if (project->CheckNeedsBuild(file,false)) { fileitem->SetDisplayState(SFITEM_NEEDS_BUILD); fProjectList->InvalidateItem(fProjectList->IndexOf(fileitem)); } else file->SetBuildFlag(BUILD_NO); } else { fileitem->SetDisplayState(SFITEM_MISSING); fProjectList->InvalidateItem(fProjectList->IndexOf(fileitem)); } } } } BNode node(fProject->GetPath().GetFullPath()); if (node.ReadAttr("project_frame",B_RECT_TYPE,0,&r,sizeof(BRect)) == sizeof(BRect)) { if (r.Width() < 200) r.right = r.left + 200; if (r.Height() < 200) r.top = r.bottom + 200; MoveTo(r.left,r.top); ResizeTo(r.Width(),r.Height()); } fProjectList->MakeFocus(true); if (gShowFolderOnOpen) { // Duplicated code from MessageReceived::M_SHOW_PROJECT_FOLDER. Doing // it here in combo with snooze() makes it much more likely that the // opened project window is frontmost instead of the project folder's window entry_ref ref; BEntry(fProject->GetPath().GetFolder()).GetRef(&ref); BMessenger msgr("application/x-vnd.Be-TRAK"); BMessage reply; BMessage openmsg(B_REFS_RECEIVED); openmsg.AddRef("refs",&ref); msgr.SendMessage(&openmsg); snooze(50000); } if (gAutoSyncModules) PostMessage(M_SYNC_MODULES); }
StartWindow::StartWindow(void) : BWindow(BRect(0, 0, -1, -1), "Paladin", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { RegisterWindow(); AddShortcut('O', B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT)); AddShortcut('N', B_COMMAND_KEY, new BMessage(M_NEW_PROJECT)); AddShortcut('I', B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT)); AddCommonFilter(new EscapeCancelFilter()); // new button and label fNewButton = make_button("new", "NewProjectButtonUp.png", "NewProjectButtonDown.png", M_NEW_PROJECT); ClickableStringView* newLabel = make_label(fNewButton, TR("Create a new project")); newLabel->SetMessage(new BMessage(M_NEW_PROJECT)); // open button and label fOpenButton = make_button("open", "OpenProjectButtonUp.png", "OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT); ClickableStringView* openLabel = make_label(fOpenButton, "Open a project"); openLabel->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT)); // open recent button and label fOpenRecentButton = make_button("openrecent", "OpenRecentButtonUp.png", "OpenRecentButtonDown.png", M_OPEN_SELECTION); SetToolTip(fOpenRecentButton, TR("Open a project in the list on the right. You " "can also press Command + a number key.")); ClickableStringView* openRecentLabel = make_label(fOpenRecentButton, TR("Open the selected project")); openRecentLabel->SetMessage(new BMessage(M_OPEN_SELECTION)); // quick import button and label fQuickImportButton = make_button("quickimport", "QuickImportButtonUp.png", "QuickImportButtonDown.png", M_SHOW_IMPORT); SetToolTip(fQuickImportButton, TR("Quickly make a project by importing all source files and resource files.\n" "You can also import a BeIDE project.")); ClickableStringView* quickImportLabel = make_label(fQuickImportButton, "Import an existing project"); quickImportLabel->SetMessage(new BMessage(M_SHOW_IMPORT)); SetToolTip(quickImportLabel, TR("Quickly make a project by importing all source files " "and resource files.\n You can also import a BeIDE project.")); // online import button and label fOnlineImportButton = make_button("onlineimport", "OnlineImportButtonUp.png", "OnlineImportButtonDown.png", M_ONLINE_IMPORT); SetToolTip(fQuickImportButton, TR("Import a project from an online repository")); ClickableStringView* onlineImportLabel = make_label(fOnlineImportButton, "Import a project from online"); onlineImportLabel->SetMessage(new BMessage(M_ONLINE_IMPORT)); SetToolTip(onlineImportLabel, TR("Import a project from an online repository")); // recent projects list view and scroller fRecentProjectsListView = new RecentProjectsList(); // set the minimum width to 16em float minWidth = fRecentProjectsListView->StringWidth("M") * 16; fRecentProjectsListView->SetExplicitMinSize(BSize(minWidth, B_SIZE_UNSET)); fRecentProjectsListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION)); SetToolTip(fRecentProjectsListView, "Open a recent project. You can also press Command + a number key."); BLayoutBuilder::Group<>(this, B_HORIZONTAL) .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING) .Add(fNewButton, 0, 0) .Add(newLabel, 1, 0) .Add(fOpenButton, 0, 1) .Add(openLabel, 1, 1) .Add(fOpenRecentButton, 0, 2) .Add(openRecentLabel, 1, 2) .Add(fQuickImportButton, 0, 3) .Add(quickImportLabel, 1, 3) .Add(fOnlineImportButton, 0, 4) .Add(onlineImportLabel, 1, 4) .End() .AddStrut(20) .AddGroup(B_VERTICAL, B_USE_SMALL_SPACING) .Add(new BStringView("recentProjectsLabel", TR("Recent projects:"))) .Add(new BScrollView("recentProjectsScroller", fRecentProjectsListView, 0, false, true)) .End() .SetInsets(B_USE_DEFAULT_SPACING) .End(); #ifdef DISABLE_ONLINE_IMPORT fOnlineImportButton->Hide(); #endif BMessenger messager(this); BEntry entry(gProjectPath.GetFullPath()); entry_ref ref; entry.GetRef(&ref); fOpenPanel = new BFilePanel(B_OPEN_PANEL, &messager, &ref, B_FILE_NODE, true, new BMessage(M_OPEN_PROJECT)); BString titleString(TR("Open Project")); titleString.Prepend("Paladin: "); fOpenPanel->Window()->SetTitle(titleString.String()); fImportPanel = new BFilePanel(B_OPEN_PANEL, &messager, &ref, B_DIRECTORY_NODE, true, new BMessage(M_QUICK_IMPORT)); titleString = TR("Choose Project Folder"); titleString.Prepend("Paladin: "); fImportPanel->Window()->SetTitle(titleString.String()); gSettings.Lock(); int32 index = 0; while (gSettings.FindRef("recentitems", index++, &ref) == B_OK) { if (!BEntry(&ref).Exists()) { index--; gSettings.RemoveData("recentitems",index); } else fRecentProjectsListView->AddItem(new RefStringItem(ref),0); } gSettings.Unlock(); // Alt + number opens that number project from the list int32 count = (fRecentProjectsListView->CountItems() > 9) ? 9 : fRecentProjectsListView->CountItems(); for (int32 i = 0; i < count; i++) { BMessage* listMessage = new BMessage(M_OPEN_FROM_LIST); listMessage->AddInt32("index", i); AddShortcut('1' + i, B_COMMAND_KEY, listMessage); } fNewButton->MakeFocus(true); CenterOnScreen(); }
wxDragResult wxDropSource::DoDragDrop(int flags) { wxCHECK_MSG( m_data && m_data->GetFormatCount(), wxDragNone, wxT("Drop source: no data") ); // still in drag if (g_blockEventsOnDrag) return wxDragNone; // don't start dragging if no button is down if (g_lastButtonNumber == 0) return wxDragNone; // we can only start a drag after a mouse event if (g_lastMouseEvent == NULL) return wxDragNone; // disabled for now g_blockEventsOnDrag = true; RegisterWindow(); m_waiting = true; GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 ); wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ]; m_data->GetAllFormats( array ); size_t count = m_data->GetFormatCount(); for (size_t i = 0; i < count; i++) { GdkAtom atom = array[i]; #ifdef __WXDEBUG__ wxLogTrace(TRACE_DND, wxT("Drop source: Supported atom %s"), gdk_atom_name( atom )); #endif gtk_target_list_add( target_list, atom, 0, 0 ); } delete[] array; int action = GDK_ACTION_COPY; if ( flags & wxDrag_AllowMove ) action |= GDK_ACTION_MOVE; // VZ: as we already use g_blockEventsOnDrag it shouldn't be that bad // to use a global to pass the flags to the drop target but I'd // surely prefer a better way to do it gs_flagsForDrag = flags; GdkDragContext *context = gtk_drag_begin( m_widget, target_list, (GdkDragAction)action, g_lastButtonNumber, // number of mouse button which started drag (GdkEvent*) g_lastMouseEvent ); m_dragContext = context; PrepareIcon( action, context ); while (m_waiting) gtk_main_iteration(); m_retValue = ConvertFromGTK(context->action); if ( m_retValue == wxDragNone ) m_retValue = wxDragCancel; g_blockEventsOnDrag = false; UnregisterWindow(); return m_retValue; }
StartWindow::StartWindow(void) : DWindow(BRect(0,0,400,300),"Paladin",B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE) { RegisterWindow(); AddShortcut('O',B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT)); AddShortcut('N',B_COMMAND_KEY, new BMessage(M_NEW_PROJECT)); AddShortcut('I',B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT)); AddCommonFilter(new EscapeCancelFilter()); MakeCenteredOnShow(true); BView *top = GetBackgroundView(); fNewButton = MakeButton("new","NewProjectButtonUp.png","NewProjectButtonDown.png", M_NEW_PROJECT); top->AddChild(fNewButton); fNewButton->MoveTo(10,10); ClickableStringView *label = MakeLabel(fNewButton,TR("Create a new project")); top->AddChild(label); label->SetMessage(new BMessage(M_NEW_PROJECT)); fOpenButton = MakeButton("open","OpenProjectButtonUp.png", "OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT); top->AddChild(fOpenButton); fOpenButton->MoveTo(10,fNewButton->Frame().bottom + 10.0); label = MakeLabel(fOpenButton,"Open a project"); top->AddChild(label); label->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT)); fOpenRecentButton = MakeButton("openrecent","OpenRecentButtonUp.png", "OpenRecentButtonDown.png", M_OPEN_SELECTION); top->AddChild(fOpenRecentButton); fOpenRecentButton->MoveTo(10,fOpenButton->Frame().bottom + 10.0); SetToolTip(fOpenRecentButton,TR("Open a project in the list on the right. You " "can also press Command + a number key.")); label = MakeLabel(fOpenRecentButton,TR("Open the selected project")); top->AddChild(label); label->SetMessage(new BMessage(M_OPEN_SELECTION)); BRect r(Bounds()); r.left = label->Frame().right + 20.0; r.right -= B_V_SCROLL_BAR_WIDTH + 10.0; r.top += 10.0; r.bottom -= 10.0; fListView = new StartWindowList(r); BScrollView *scrollView = new BScrollView("scroller",fListView,0, B_FOLLOW_ALL, false, true); top->AddChild(scrollView); fListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION)); SetToolTip(fListView, "Open a recent project. You can also press Command + a number key."); fQuickImportButton = MakeButton("quickimport","QuickImportButtonUp.png", "QuickImportButtonDown.png",M_SHOW_IMPORT); top->AddChild(fQuickImportButton); fQuickImportButton->MoveTo(10,fOpenRecentButton->Frame().bottom + 10.0); label = MakeLabel(fQuickImportButton,"Import an existing project"); top->AddChild(label); label->SetMessage(new BMessage(M_SHOW_IMPORT)); SetToolTip(label,TR("Quickly make a project by importing all source files and resource files.\n" "You can also import a BeIDE project.")); SetToolTip(fQuickImportButton, TR("Quickly make a project by importing all source files and resource files.\n" "You can also import a BeIDE project.")); fOnlineImportButton = MakeButton("onlineimport","OnlineImportButtonUp.png", "OnlineImportButtonDown.png",M_ONLINE_IMPORT); top->AddChild(fOnlineImportButton); fOnlineImportButton->MoveTo(10,fQuickImportButton->Frame().bottom + 10.0); label = MakeLabel(fOnlineImportButton,"Import a project from online"); top->AddChild(label); label->SetMessage(new BMessage(M_ONLINE_IMPORT)); SetToolTip(label,TR("Import a project from an online repository")); SetToolTip(fQuickImportButton, TR("Import a project from an online repository")); #ifdef DISABLE_ONLINE_IMPORT fOnlineImportButton->Hide(); SetSizeLimits(scrollView->Frame().left + 110.0,30000, fQuickImportButton->Frame().bottom + 10.0,30000); ResizeTo(scrollView->Frame().left + 160.0,fQuickImportButton->Frame().bottom + 10.0); #else SetSizeLimits(scrollView->Frame().left + 110.0,30000, fOnlineImportButton->Frame().bottom + 10.0,30000); ResizeTo(scrollView->Frame().left + 160.0,fOnlineImportButton->Frame().bottom + 10.0); #endif BMessenger msgr(this); BEntry entry(gProjectPath.GetFullPath()); entry_ref ref; entry.GetRef(&ref); fOpenPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_FILE_NODE,true, new BMessage(M_OPEN_PROJECT)); BString titleString(TR("Open Project")); titleString.Prepend("Paladin: "); fOpenPanel->Window()->SetTitle(titleString.String()); fImportPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_DIRECTORY_NODE,true, new BMessage(M_QUICK_IMPORT)); titleString = TR("Choose Project Folder"); titleString.Prepend("Paladin: "); fImportPanel->Window()->SetTitle(titleString.String()); gSettings.Lock(); int32 index = 0; while (gSettings.FindRef("recentitems",index++,&ref) == B_OK) { if (!BEntry(&ref).Exists()) { index--; gSettings.RemoveData("recentitems",index); } else fListView->AddItem(new RefStringItem(ref),0); } gSettings.Unlock(); // Alt + number opens that number project from the list int32 count = (fListView->CountItems() > 9) ? 9 : fListView->CountItems(); for (int32 i = 0; i < count; i++) { BMessage *listMsg = new BMessage(M_OPEN_FROM_LIST); listMsg->AddInt32("index", i); AddShortcut('1' + i, B_COMMAND_KEY, listMsg); } fNewButton->MakeFocus(true); }
tcRegistered::tcRegistered() : myKey(nextKey++) { RegisterWindow(myKey); }