void CSyncDlg::FetchComplete() { EnableControlButton(true); SwitchToInput(); this->FetchOutList(true); if (g_Git.UsingLibGit2(CGit::GIT_CMD_FETCH)) ShowTab(IDC_CMD_GIT_PROG); else ShowTab(IDC_REFLIST); if( (!this->m_GitCmdStatus) && this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE) { CRebaseDlg dlg; CString remote, remotebranch; m_ctrlURL.GetWindowText(remote); if (!remote.IsEmpty()) { STRING_VECTOR remotes; g_Git.GetRemoteList(remotes); if (std::find(remotes.begin(), remotes.end(), remote) == remotes.end()) remote.Empty(); } m_ctrlRemoteBranch.GetWindowText(remotebranch); if (!remote.IsEmpty() && !remotebranch.IsEmpty()) dlg.m_Upstream = _T("remotes/") + remote + _T("/") + remotebranch; dlg.m_PostButtonTexts.Add(CString(MAKEINTRESOURCE(IDS_MENULOG))); dlg.m_PostButtonTexts.Add(_T("Email &Patch...")); INT_PTR response = dlg.DoModal(); if(response == IDOK) { return ; } if (response == IDC_REBASE_POST_BUTTON) { CString cmd = _T("/command:log"); cmd += _T(" /path:\"") + g_Git.m_CurrentDir + _T("\""); CAppUtils::RunTortoiseGitProc(cmd); } if(response == IDC_REBASE_POST_BUTTON + 1) { CString cmd, out, err; cmd.Format(_T("git.exe format-patch -o \"%s\" %s..%s"), g_Git.m_CurrentDir, g_Git.FixBranchName(dlg.m_Upstream), g_Git.FixBranchName(dlg.m_Branch)); if (g_Git.Run(cmd, &out, &err, CP_UTF8)) { CMessageBox::Show(NULL, out + L"\n" + err, _T("TortoiseGit"), MB_OK|MB_ICONERROR); return ; } CAppUtils::SendPatchMail(cmd,out); } } }
void MsnEditNavDlg::OnTabButton(AWEvent* event) { if (!event) return; if (event->window == btn_sit) ShowTab(0); else if (event->window == btn_pkg) ShowTab(1); else if (event->window == btn_map) ShowTab(2); }
void CSyncDlg::RunPostAction() { if (m_bWantToExit) return; FillNewRefMap(); if (this->m_CurrentCmd == GIT_COMMAND_PUSH) { if (!m_GitCmdStatus) { CTGitPathList list; list.AddPath(CTGitPath(g_Git.m_CurrentDir)); DWORD exitcode; CString error; if (CHooks::Instance().PostPush(list,exitcode, error)) { if (exitcode) { CString temp; temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error); //ReportError(temp); CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR); return; } } } EnableControlButton(true); SwitchToInput(); this->FetchOutList(true); } else if (this->m_CurrentCmd == GIT_COMMAND_PULL) { PullComplete(); } else if (this->m_CurrentCmd == GIT_COMMAND_FETCH || this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE) { FetchComplete(); } else if (this->m_CurrentCmd == GIT_COMMAND_SUBMODULE) { //this->m_ctrlCmdOut.SetSel(-1,-1); //this->m_ctrlCmdOut.ReplaceSel(_T("Done\r\n")); //this->m_ctrlCmdOut.SetSel(-1,-1); EnableControlButton(true); SwitchToInput(); } else if (this->m_CurrentCmd == GIT_COMMAND_STASH) { StashComplete(); } else if (this->m_CurrentCmd == GIT_COMMAND_REMOTE) { this->FetchOutList(true); EnableControlButton(true); SwitchToInput(); ShowTab(IDC_REFLIST); } }
CWindow CRegisterTabs::AddTab(char* caption, int dialogId, DLGPROC dlgProc) { AddItem(caption); CWindow parentWin = GetParent(); CWindow tabWin = ::CreateDialogParam(NULL, MAKEINTRESOURCE(dialogId), parentWin, dlgProc, (LPARAM)&m_attached); CRect pageRect = GetPageRect(); ::SetParent(tabWin, parentWin); ::SetWindowPos( tabWin, m_hWnd, pageRect.left, pageRect.top, pageRect.Width(), pageRect.Height(), SWP_HIDEWINDOW ); m_TabWindows.push_back(tabWin); int index = m_TabWindows.size() - 1; if (index == 0) { ShowTab(0); } return tabWin; }
void TabControl::NextTab(bool cycle) { int index = TabCtrl_GetCurSel(hwnd); if (index == tabs.size()-1 && cycle) index = 0; ShowTab(index); }
void TabControl::AddTabDialog(Dialog* dialog, wchar_t* title) { HWND handle = dialog->GetDlgHandle(); TCITEM tcItem; ZeroMemory (&tcItem,sizeof (tcItem)); tcItem.mask = TCIF_TEXT; tcItem.dwState = 0; tcItem.pszText = title; tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1; tcItem.iImage = 0; int index = TabCtrl_GetItemCount(hwnd); int result = TabCtrl_InsertItem(hwnd,index,&tcItem); RECT tabRect; GetWindowRect(hwnd,&tabRect); MapWindowPoints(HWND_DESKTOP,GetParent(hwnd),(LPPOINT)&tabRect,2); TabCtrl_AdjustRect(hwnd, FALSE, &tabRect); SetParent(handle,GetParent(hwnd)); DWORD style = (GetWindowLong(handle,GWL_STYLE) | WS_CHILD) & ~(WS_POPUP | WS_TILEDWINDOW); SetWindowLong(handle, GWL_STYLE, style); MoveWindow(handle,tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top,TRUE); tabs.push_back(handle); ShowTab(index); }
HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style) { style |= WS_CHILD; TCITEM tcItem; ZeroMemory (&tcItem,sizeof (tcItem)); tcItem.mask = TCIF_TEXT; tcItem.dwState = 0; tcItem.pszText = title; tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1; tcItem.iImage = 0; int index = TabCtrl_GetItemCount(hwnd); int result = TabCtrl_InsertItem(hwnd,index,&tcItem); RECT tabRect; GetWindowRect(hwnd,&tabRect); MapWindowPoints(HWND_DESKTOP,GetParent(hwnd),(LPPOINT)&tabRect,2); TabCtrl_AdjustRect(hwnd, FALSE, &tabRect); HWND tabHandle = CreateWindowEx(0,className,title,style, tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top, GetParent(hwnd),0,MainWindow::GetHInstance(),0); tabs.push_back(tabHandle); ShowTab(index); return tabHandle; }
void TabControl::PreviousTab(bool cycle) { int index = TabCtrl_GetCurSel(hwnd); if (index == 0 && cycle) index = (int) tabs.size()-1; ShowTab(index); }
void CSyncDlg::FetchComplete() { EnableControlButton(true); SwitchToInput(); this->FetchOutList(true); ShowTab(IDC_CMD_LOG); if( (!this->m_GitCmdStatus) && this->m_CurrentCmd == GIT_COMMAND_FETCHANDREBASE) { CRebaseDlg dlg; dlg.m_PostButtonTexts.Add(_T("Email &Patch...")); int response = dlg.DoModal(); if(response == IDOK) { return ; } if(response == IDC_REBASE_POST_BUTTON) { CString cmd, out, err; cmd.Format(_T("git.exe format-patch -o \"%s\" %s..%s"), g_Git.m_CurrentDir, g_Git.FixBranchName(dlg.m_Upstream), g_Git.FixBranchName(dlg.m_Branch)); if(g_Git.Run(cmd, &out, &err, CP_ACP)) { CMessageBox::Show(NULL, out + L"\n" + err, _T("TortoiseGit"), MB_OK|MB_ICONERROR); return ; } CAppUtils::SendPatchMail(cmd,out); } } }
HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style) { TabInfo info; info.hasBorder = (style & WS_BORDER) != 0; style = (style |WS_CHILD) & tabControlStyleMask; if (showTabTitles) AppendPageToControl(title); int index = (int)tabs.size(); RECT tabRect; GetWindowRect(hwnd,&tabRect); MapWindowPoints(HWND_DESKTOP,GetParent(hwnd),(LPPOINT)&tabRect,2); TabCtrl_AdjustRect(hwnd, FALSE, &tabRect); HWND tabHandle = CreateWindowEx(0,className,title,style, tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top, GetParent(hwnd),0,MainWindow::GetHInstance(),0); info.hasClientEdge = (GetWindowLong(tabHandle,GWL_EXSTYLE) & WS_EX_CLIENTEDGE) != 0; if (hasButtons == false) { SetWindowLong(tabHandle, GWL_STYLE, GetWindowLong(tabHandle,GWL_STYLE) & (~WS_BORDER)); SetWindowLong(tabHandle, GWL_EXSTYLE, GetWindowLong(tabHandle,GWL_EXSTYLE) & (~WS_EX_CLIENTEDGE)); } info.lastFocus = tabHandle; info.pageHandle = tabHandle; wcscpy_s(info.title,title); tabs.push_back(info); ShowTab(index); return tabHandle; }
// CMFCTabCtrlEx 메시지 처리기입니다. LRESULT CMFCTabCtrlEx::OnCloseEpub(WPARAM wParam, LPARAM lParam) { TRACE(_T("CMFCTabCtrlEx::OnCloseEpub() START\r\n")); // HRESULT hr = S_OK; // Remove epub theApp.m_WebkitEngine.Close((CWnd *)wParam); // Remove tab int tabID = (int)lParam; int index = GetTabByID(tabID); if(index >= 0) { int next = -1; if(index + 1 < GetTabsNum()) next = index + 1; else if( index - 1 >= 0 ) next = index - 1; // if( next >= 0) { SetActiveTab(next); ShowTab(next); } if(!RemoveTab(index)) return S_FALSE; } // TRACE(_T("CMFCTabCtrlEx::OnCloseEpub() END\r\n")); return hr; }
void TabControl::HandleNotify(LPARAM lParam) { NMHDR* pNotifyMessage = NULL; pNotifyMessage = (LPNMHDR)lParam; if (pNotifyMessage->hwndFrom == hwnd) { int iPage = TabCtrl_GetCurSel(hwnd); ShowTab(iPage,false); } }
void JXTabGroup::Activate() { JXWidget::Activate(); JIndex i; if (WouldBeActive() && GetTabCount() > 0 && !GetCurrentTabIndex(&i)) { ShowTab(1); } }
void TabControl::PreviousTab(bool cycle) { int index = CurrentTabIndex()-1; if (index < 0) { if (cycle == false) index = 0; else index = (int) tabs.size()-1; } ShowTab(index); }
void TabControl::NextTab(bool cycle) { int index = CurrentTabIndex()+1; if (index == tabs.size()) { if (cycle == false) index--; else index = 0; } ShowTab(index); }
void JXTabGroup::HandleDNDHere ( const JPoint& pt, const JXWidget* source ) { JIndex i; JRect r; if (FindTab(pt, &i, &r)) { ShowTab(i); } }
void CSyncDlg::StashComplete() { EnableControlButton(true); INT_PTR entry = m_ctrlStash.GetCurrentEntry(); if (entry != 1 && entry != 2) return; SwitchToInput(); if (m_GitCmdStatus) { CTGitPathList list; if (g_Git.ListConflictFile(list)) { m_ctrlCmdOut.SetSel(-1, -1); m_ctrlCmdOut.ReplaceSel(_T("Get conflict files fail\n")); ShowTab(IDC_CMD_LOG); return; } if (!list.IsEmpty()) { m_ConflictFileList.Clear(); CTGitPathList list; CTGitPath path; list.AddPath(path); m_ConflictFileList.GetStatus(&list,true); m_ConflictFileList.Show(CTGitPath::LOGACTIONS_UNMERGED, CTGitPath::LOGACTIONS_UNMERGED); ShowTab(IDC_IN_CONFLICT); } else ShowTab(IDC_CMD_LOG); } }
JXWidgetSet* JXTabGroup::RemoveTab ( const JIndex index ) { JIndex selIndex; const JBoolean hasSelection = itsCardFile->GetCurrentCardIndex(&selIndex); if (hasSelection && index == selIndex && itsPrevTabIndex > 0 && itsPrevTabIndex != index) { ShowTab(itsPrevTabIndex); } else if (hasSelection && index == selIndex && index > 1) { ShowTab(index-1); } else if (hasSelection && index == selIndex && index < GetTabCount()) { ShowTab(index+1); } itsPrevTabIndex = 0; if (itsCanScrollUpFlag && !itsCanScrollDownFlag) { JXScrollTabsTask* task = new JXScrollTabsTask(this); assert( task != NULL ); task->Go(); } Refresh(); itsTitles->DeleteElement(index); itsTabInfoList->RemoveElement(index); return itsCardFile->RemoveCard(index); }
JBoolean JXTabGroup::ShowTab ( JXWidgetSet* card ) { JIndex index; if (itsCardFile->GetCardIndex(card, &index)) { return ShowTab(index); } else { return kJFalse; } }
void CSyncDlg::OnBnClickedButtonStash() { UpdateData(); UpdateCombox(); m_ctrlCmdOut.SetWindowTextW(_T("")); m_LogText = ""; SwitchToRun(); m_bAbort = false; m_GitCmdList.clear(); ShowTab(IDC_CMD_LOG); m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST - 1, false); m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST -1, false); m_ctrlTabCtrl.ShowTab(IDC_IN_CONFLICT -1, false); CString cmd; switch (m_ctrlStash.GetCurrentEntry()) { case 0: cmd = _T("git.exe stash save"); break; case 1: cmd = _T("git.exe stash pop"); break; case 2: cmd = _T("git.exe stash apply"); break; } m_GitCmdList.push_back(cmd); m_CurrentCmd = GIT_COMMAND_STASH; m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL, 0, CREATE_SUSPENDED); if (!m_pThread) { //ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } }
void CSyncDlg::OnBnClickedButtonSubmodule() { this->UpdateData(); UpdateCombox(); m_ctrlCmdOut.SetWindowTextW(_T("")); m_LogText = ""; this->m_regSubmoduleButton = (DWORD)this->m_ctrlSubmodule.GetCurrentEntry(); this->SwitchToRun(); this->m_bAbort=false; this->m_GitCmdList.clear(); ShowTab(IDC_CMD_LOG); CString cmd; switch (m_ctrlSubmodule.GetCurrentEntry()) { case 0: cmd=_T("git.exe submodule update --init"); break; case 1: cmd=_T("git.exe submodule init"); break; case 2: cmd=_T("git.exe submodule sync"); break; } m_GitCmdList.push_back(cmd); m_CurrentCmd = GIT_COMMAND_SUBMODULE; m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } }
void JXTabGroup::ShowNextTab() { JIndex index; if (!GetCurrentTabIndex(&index)) { index = 0; } index++; if (index > GetTabCount()) { index = 1; } ShowTab(index); }
void JXTabGroup::ShowPreviousTab() { JIndex index; if (!GetCurrentTabIndex(&index)) { index = 2; } index--; if (index == 0) { index = GetTabCount(); } ShowTab(index); }
void GameTablesDialog::InsertHighScoreSlot(CCGame* g) { if (GetSettings()->mHighScoreHandling == Settings::HIGHSCORE_NO) { return; } if (GetHighScoresModel()->IsValidHighScore(g->mScore)) { CCGame game = *g; game.SetUserName(GetSettings()->mHighScoreUserName); if (GetSettings()->mHighScoreHandling != Settings::HIGHSCORE_AUTO || GetSettings()->mHighScoreUserName == "") { ShowTab(GameTablesDialog::TABIX_HIGHSCORES); } GetHighScoresModel()->InsertRow(game); } }
void TabControl::AddTab(HWND handle, wchar_t* title) { if (showTabTitles) AppendPageToControl(title); int index = (int)tabs.size(); TabInfo info = {0}; if (!noDisplayArea_) { RECT tabRect; GetWindowRect(hwnd,&tabRect); MapWindowPoints(HWND_DESKTOP,GetParent(hwnd),(LPPOINT)&tabRect,2); TabCtrl_AdjustRect(hwnd, FALSE, &tabRect); SetParent(handle,GetParent(hwnd)); DWORD style = (GetWindowLong(handle,GWL_STYLE) | WS_CHILD); info.hasBorder = (style & WS_BORDER) != 0; info.hasClientEdge = (GetWindowLong(handle,GWL_EXSTYLE) & WS_EX_CLIENTEDGE) != 0; if (hasButtons == false) { style &= (~WS_BORDER); SetWindowLong(handle, GWL_EXSTYLE, GetWindowLong(handle,GWL_EXSTYLE) & (~WS_EX_CLIENTEDGE)); } SetWindowLong(handle, GWL_STYLE, style & tabControlStyleMask); MoveWindow(handle,tabRect.left,tabRect.top,tabRect.right-tabRect.left,tabRect.bottom-tabRect.top,TRUE); } info.lastFocus = handle; info.pageHandle = handle; wcscpy_s(info.title,title); tabs.push_back(info); ShowTab(index); }
// Main window procedure to control the program LRESULT CALLBACK MainWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch ( msg ) { // Process click messages case WM_COMMAND: { ShowTab((HWND)lParam); // Set tab states ModifyEdits((HWND)lParam); FlameRamCheckState((HWND)lParam); // Check processing for Flame Ram tab and elements CatapultCheckState((HWND)lParam); // Check processing for Catapult tab and elements TrebuchetCheckState((HWND)lParam); // Check processing for Trbuchet tab and elements MenuCheckState(hWnd, msg, wParam, lParam); if ( ((HWND)lParam) == GlobalSettings.hChatButton ) SendChat(); break; } // Process Scrollbar messages case WM_HSCROLL: { int nValue; char buffer[32]; // Set global values for Scrollbar if ( ((HWND)lParam) == GlobalSettings.hCatSliderBar ) { if ( UserSettings.CatRange < UserSettings.CatMin ) nValue = UserSettings.CatMin; else if ( UserSettings.CatRange > UserSettings.CatMax ) nValue = UserSettings.CatMax; else nValue = UserSettings.CatRange; } else if ( ((HWND)lParam) == GlobalSettings.hTrebSliderBar ) { if ( UserSettings.TrebRange < UserSettings.TrebMin ) nValue = UserSettings.TrebMin; else if ( UserSettings.TrebRange > UserSettings.TrebMax ) nValue = UserSettings.TrebMax; else nValue = UserSettings.TrebRange; } else break; // Process Scrollbar message types switch ( LOWORD(wParam) ) { case SB_PAGELEFT: case SB_LINELEFT: if ( (nValue - 1) >= 0 ) nValue--; // Decrease by 1 unit break; case SB_PAGERIGHT: case SB_LINERIGHT: if ( ((HWND)lParam) == GlobalSettings.hCatSliderBar ) { if ( (nValue + 1) <= UserSettings.CatMax ) nValue++; // Increase by 1 unit } else if ( ((HWND)lParam) == GlobalSettings.hTrebSliderBar ) { if ( (nValue + 1) <= UserSettings.TrebMax ) nValue++; // Increase by 1 unit } break; case SB_LEFT: case SB_RIGHT: case SB_THUMBPOSITION: case SB_THUMBTRACK: nValue = HIWORD(wParam); // Set nValue to selected value break; default: break; } // Set Scrollbar selector to nValue SetScrollPos((HWND)lParam, SB_CTL, nValue, TRUE); // Set range readout for Catapult Scrollbar if ( ((HWND)lParam) == GlobalSettings.hCatSliderBar ) { UserSettings.CatRange = nValue; memset(buffer, 0, sizeof(buffer)); // Calculate range to the 10ths _snprintf(buffer, sizeof(buffer)-1, "Range: %.2f", (((float)(UserSettings.CatRange - UserSettings.CatMin) / (float)(UserSettings.CatMax - UserSettings.CatMin)) * 100) ); SendMessage(GlobalSettings.hCatSliderValue, WM_SETTEXT, 0, (LPARAM)buffer); // Set Catapult state values CatapultCheckState((HWND)lParam); } // Set range readout for Trebuchet Scrollbar else if ( ((HWND)lParam) == GlobalSettings.hTrebSliderBar ) { UserSettings.TrebRange = nValue; memset(buffer, 0, sizeof(buffer)); // Calculate range to the 10ths _snprintf(buffer, sizeof(buffer)-1, "Range: %.2f", (((float)(UserSettings.TrebRange - UserSettings.TrebMin) / (float)(UserSettings.TrebMax - UserSettings.TrebMin)) * 100) ); SendMessage(GlobalSettings.hTrebSliderValue, WM_SETTEXT, 0, (LPARAM)buffer); // Set Trebuchet state values TrebuchetCheckState((HWND)lParam); } break; } // Build main window and relocate to last known position case WM_CREATE: { WINDOWPLACEMENT wp; HICON hMainIcon; // Load main program icon for window hMainIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAINICON)); SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)hMainIcon); // Restore last known coordinates memset(&wp, 0, sizeof(wp)); wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hWnd, &wp); UserSettings.MainX = wp.rcNormalPosition.left; UserSettings.MainY = wp.rcNormalPosition.top; break; } //WM_CREATE case WM_SIZE: { SetWindowState(); break; } // Get window placement information case WM_MOVE: { WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hWnd, &wp); UserSettings.MainX = wp.rcNormalPosition.left; UserSettings.MainY = wp.rcNormalPosition.top; break; } // Cleanup threads and windows, and save settings case WM_CLOSE: SaveSettings(); if ( GlobalSettings.dwThreadId ) TerminateThread(GlobalSettings.hThread, 0); DestroyWindow(hWnd); break; // Cleanup threads and windows, and save settings case WM_DESTROY: SaveSettings(); if ( GlobalSettings.dwThreadId ) TerminateThread(GlobalSettings.hThread, 0); PostQuitMessage(0); break; // Pass all other messages default: return DefWindowProc(hWnd, msg, wParam, lParam); } return DefWindowProc(hWnd, msg, wParam, lParam); }
void HeaderCtrl::Serialize(Stream& s) { int version = 0x04; s / version; if(version >= 0x04) { int n = col.GetCount(); s / n; Array<Column> col2 = clone(col); if(s.IsLoading()) col2.InsertN(0, n); for(int i = 0; i < n; i++) { int ndx = col2[i].index; s % ndx; if(s.IsLoading()) for(int j = n; j < col2.GetCount(); j++) if(col2[j].index == ndx) { col2.Swap(i, j); break; } col2[i].index = ndx; s % col2[i].ratio; s % col2[i].visible; } if(s.IsLoading() && n == col.GetCount()) { col2.Trim(n); col = pick(col2); } } else if(version < 0x01) { int n = col.GetCount(); s / n; for(int i = 0; i < n; i++) if(i < col.GetCount()) { int n = 1; s / n; col[i].ratio = n; } else { int dummy = 0; s / dummy; } } else { int n = col.GetCount(); s / n; if(version < 0x02) for(int i = 0; i < n; i++) if(i < col.GetCount()) s % col[i].ratio; else { int dummy = 0; s % dummy; } else { int t = 0; for(int i = 0; i < n; i++) { if(n == col.GetCount()) { int ndx = col[i].index; double r = col[i].ratio; s % ndx; s % r; int q = FindIndex(ndx); if(q >= 0) { col[q].ratio = r; col.Swap(t++, q); } if(version >= 0x03) { bool visible = IsTabVisible(i); s % visible; if(i < GetCount()) ShowTab(i, visible); } } else { int dummy = 0; double dummy2 = 1.0; bool dummy3 = false; s % dummy; s % dummy2; if(version >= 0x03) s % dummy3; } } } } if(s.IsLoading()) { ReCompute(); Refresh(); WhenLayout(); } }
void JXTabGroup::HandleMouseDown ( const JPoint& pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates& buttonStates, const JXKeyModifiers& modifiers ) { itsDragAction = kInvalidClick; if (button == kJXLeftButton && itsScrollUpRect.Contains(pt)) { if (itsCanScrollUpFlag && itsFirstDrawIndex > 1) // avoid left click when arrow disabled { itsDragAction = kScrollUp; itsScrollUpPushedFlag = kJTrue; itsFirstDrawIndex--; Refresh(); ScrollWait(kInitialScrollDelay); itsScrollUpPushedFlag = kJFalse; // ignore first HandleMouseDrag() } } else if (button == kJXLeftButton && itsScrollDownRect.Contains(pt)) { if (itsCanScrollDownFlag && itsFirstDrawIndex < GetTabCount()) // avoid left click when arrow disabled { itsDragAction = kScrollDown; itsScrollDownPushedFlag = kJTrue; itsFirstDrawIndex++; Refresh(); ScrollWait(kInitialScrollDelay); itsScrollDownPushedFlag = kJFalse; // ignore first HandleMouseDrag() } } else if (button == kJXLeftButton && itsMouseIndex > 0 && itsCloseRect.Contains(pt)) { itsDragAction = kClose; itsClosePushedFlag = kJTrue; Refresh(); } else if (button == kJXLeftButton) { JIndex i; JRect r; if (FindTab(pt, &i, &r)) { ShowTab(i); } } else if (button == kJXRightButton) { CreateContextMenu(); itsContextMenu->PopUp(this, pt, buttonStates, modifiers); } else { ScrollForWheel(button, modifiers); } }
void CSyncDlg::OnBnClickedButtonPush() { this->UpdateData(); UpdateCombox(); m_ctrlCmdOut.SetWindowTextW(_T("")); m_LogText = ""; if(this->m_strURL.IsEmpty()) { CMessageBox::Show(NULL, IDS_PROC_GITCONFIG_URLEMPTY, IDS_APPNAME, MB_OK | MB_ICONERROR); return; } this->m_regPushButton=(DWORD)this->m_ctrlPush.GetCurrentEntry(); this->SwitchToRun(); this->m_bAbort=false; this->m_GitCmdList.clear(); ShowTab(IDC_CMD_LOG); CString cmd; CString arg; CString error; DWORD exitcode; CTGitPathList list; list.AddPath(CTGitPath(g_Git.m_CurrentDir)); if (CHooks::Instance().PrePush(list,exitcode, error)) { if (exitcode) { CString temp; temp.Format(IDS_ERR_HOOKFAILED, (LPCTSTR)error); //ReportError(temp); CMessageBox::Show(NULL,temp,_T("TortoiseGit"),MB_OK|MB_ICONERROR); return ; } } CString refName = g_Git.FixBranchName(m_strLocalBranch); switch (m_ctrlPush.GetCurrentEntry()) { case 1: arg += _T(" --tags "); break; case 2: refName = _T("refs/notes/commits"); //default ref for notes break; } if(this->m_bForce) arg += _T(" --force "); if(m_Gitverion >= 0x01070203) //above 1.7.0.2 arg += _T("--progress "); cmd.Format(_T("git.exe push -v %s \"%s\" %s"), arg, m_strURL, refName); if (!m_strRemoteBranch.IsEmpty() && m_ctrlPush.GetCurrentEntry() != 2) { cmd += _T(":") + m_strRemoteBranch; } m_GitCmdList.push_back(cmd); m_CurrentCmd = GIT_COMMAND_PUSH; if(this->m_bAutoLoadPuttyKey) { CAppUtils::LaunchPAgent(NULL,&this->m_strURL); } m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } }
void CSyncDlg::OnBnClickedButtonPull() { int CurrentEntry; CurrentEntry = (int)this->m_ctrlPull.GetCurrentEntry(); this->m_regPullButton = CurrentEntry; this->m_bAbort=false; this->m_GitCmdList.clear(); m_ctrlCmdOut.SetWindowTextW(_T("")); m_LogText = ""; this->UpdateData(); UpdateCombox(); if (g_Git.GetHash(m_oldHash, _T("HEAD"))) { MessageBox(g_Git.GetGitLastErr(_T("Could not get HEAD hash.")), _T("TortoiseGit"), MB_ICONERROR); return; } m_refList.Clear(); m_newHashMap.clear(); m_oldHashMap.clear(); if( CurrentEntry == 0) { CGitHash localBranchHash; if (g_Git.GetHash(localBranchHash, m_strLocalBranch)) { MessageBox(g_Git.GetGitLastErr(_T("Could not get hash of \"") + m_strLocalBranch + _T("\".")), _T("TortoiseGit"), MB_ICONERROR); return; } if (localBranchHash != m_oldHash) { CMessageBox::Show(NULL, IDS_PROC_SYNC_PULLWRONGBRANCH, IDS_APPNAME, MB_OK | MB_ICONERROR); return; } } if(this->m_strURL.IsEmpty()) { CMessageBox::Show(NULL, IDS_PROC_GITCONFIG_URLEMPTY, IDS_APPNAME, MB_OK | MB_ICONERROR); return; } if (m_bAutoLoadPuttyKey && CurrentEntry != 3) // CurrentEntry (Remote Update) handles this on its own) { CAppUtils::LaunchPAgent(NULL,&this->m_strURL); } this->SwitchToRun(); CString force; if(this->m_bForce) force = _T(" --force "); CString cmd; ShowTab(IDC_CMD_LOG); this->m_ctrlTabCtrl.ShowTab(IDC_REFLIST-1,true); this->m_ctrlTabCtrl.ShowTab(IDC_IN_LOGLIST-1,false); this->m_ctrlTabCtrl.ShowTab(IDC_IN_CHANGELIST-1,false); this->m_ctrlTabCtrl.ShowTab(IDC_IN_CONFLICT-1,false); ///Pull if(CurrentEntry == 0) //Pull { CString remotebranch; remotebranch = m_strRemoteBranch; if(!IsURL()) { CString configName; configName.Format(L"branch.%s.merge", this->m_strLocalBranch); CString pullBranch = CGit::StripRefName(g_Git.GetConfigValue(configName)); configName.Format(L"branch.%s.remote", m_strLocalBranch); CString pullRemote = g_Git.GetConfigValue(configName); if(pullBranch == remotebranch && pullRemote == this->m_strURL) remotebranch.Empty(); } if(m_Gitverion >= 0x01070203) //above 1.7.0.2 force += _T("--progress "); cmd.Format(_T("git.exe pull -v %s \"%s\" %s"), force, m_strURL, remotebranch); m_CurrentCmd = GIT_COMMAND_PULL; m_GitCmdList.push_back(cmd); m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } } ///Fetch if(CurrentEntry == 1 || CurrentEntry ==2 ) //Fetch { CString remotebranch; if(this->IsURL() || m_strRemoteBranch.IsEmpty()) { remotebranch=this->m_strRemoteBranch; } else { remotebranch.Format(_T("remotes/%s/%s"), m_strURL,m_strRemoteBranch); CGitHash remoteBranchHash; g_Git.GetHash(remoteBranchHash, remotebranch); if (remoteBranchHash.IsEmpty()) remotebranch=m_strRemoteBranch; else remotebranch=m_strRemoteBranch+_T(":")+remotebranch; } if(CurrentEntry == 1) m_CurrentCmd = GIT_COMMAND_FETCH; else m_CurrentCmd = GIT_COMMAND_FETCHANDREBASE; if (g_Git.UsingLibGit2(CGit::GIT_CMD_FETCH)) { CString refspec; // current libgit2 only supports well formated refspec refspec.Format(_T("refs/heads/%s:refs/remotes/%s/%s"), m_strRemoteBranch, m_strURL, m_strRemoteBranch); m_GitProgressList.SetUrl(m_strURL); m_GitProgressList.SetRefSpec(refspec); m_GitProgressList.SetCommand(CGitProgressList::GitProgress_Fetch); m_GitProgressList.Init(); ShowTab(IDC_CMD_GIT_PROG); } else { if(m_Gitverion >= 0x01070203) //above 1.7.0.2 force += _T("--progress "); cmd.Format(_T("git.exe fetch -v %s \"%s\" %s"), force, m_strURL, remotebranch); m_GitCmdList.push_back(cmd); m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } } } ///Remote Update if(CurrentEntry == 3) { if (m_bAutoLoadPuttyKey) { STRING_VECTOR list; if (!g_Git.GetRemoteList(list)) { for (size_t i = 0; i < list.size(); ++i) CAppUtils::LaunchPAgent(NULL, &list[i]); } } m_CurrentCmd = GIT_COMMAND_REMOTE; cmd=_T("git.exe remote update"); m_GitCmdList.push_back(cmd); InterlockedExchange(&m_bBlock, TRUE); m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); InterlockedExchange(&m_bBlock, FALSE); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } } ///Cleanup stale remote banches if(CurrentEntry == 4) { m_CurrentCmd = GIT_COMMAND_REMOTE; cmd.Format(_T("git.exe remote prune \"%s\""), m_strURL); m_GitCmdList.push_back(cmd); InterlockedExchange(&m_bBlock, TRUE); m_pThread = AfxBeginThread(ProgressThreadEntry, this, THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED); if (m_pThread==NULL) { // ReportError(CString(MAKEINTRESOURCE(IDS_ERR_THREADSTARTFAILED))); InterlockedExchange(&m_bBlock, FALSE); } else { m_pThread->m_bAutoDelete = TRUE; m_pThread->ResumeThread(); } } }