void RulerCtrl::SetCursor(double c) { if(c != cursor) { RefreshCursor(cursor); RefreshCursor(cursor = c); } }
UINT CFileDiffDlg::DiffThread() { RefreshCursor(); m_cFileList.ShowText(CString(MAKEINTRESOURCE(IDS_FILEDIFF_WAIT))); m_cFileList.DeleteAllItems(); m_arFileList.Clear(); EnableInputControl(false); #if 0 bool bSuccess = true; if (m_bDoPegDiff) { // bSuccess = DiffSummarizePeg(m_path1, m_peg, m_rev1, m_rev2, m_depth, m_bIgnoreancestry); } else { // bSuccess = DiffSummarize(m_path1, m_rev1, m_path2, m_rev2, m_depth, m_bIgnoreancestry); } // if (!bSuccess) // { // m_cFileList.ShowText(GetLastErrorMessage()); // InterlockedExchange(&m_bThreadRunning, FALSE); // return 0; // } #endif if( m_rev1.m_CommitHash.IsEmpty() || m_rev2.m_CommitHash.IsEmpty()) g_Git.RefreshGitIndex(); g_Git.GetCommitDiffList(m_rev1.m_CommitHash.ToString(),m_rev2.m_CommitHash.ToString(),m_arFileList); CString sFilterText; m_cFilter.GetWindowText(sFilterText); m_cFileList.SetRedraw(false); Filter(sFilterText); if (m_arFileList.GetCount()>0) { // Highlight first entry in file list m_cFileList.SetSelectionMark(0); m_cFileList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); } int mincol = 0; int maxcol = ((CHeaderCtrl*)(m_cFileList.GetDlgItem(0)))->GetItemCount()-1; int col; for (col = mincol; col <= maxcol; col++) { m_cFileList.SetColumnWidth(col,LVSCW_AUTOSIZE_USEHEADER); } m_cFileList.ClearText(); m_cFileList.SetRedraw(true); InterlockedExchange(&m_bThreadRunning, FALSE); InvalidateRect(NULL); RefreshCursor(); EnableInputControl(true); return 0; }
UINT CRevertDlg::RevertThread() { // get the status of all selected file/folders recursively // and show the ones which can be reverted to the user // in a list control. DialogEnableWindow(IDOK, false); m_bCancelled = false; m_RevertList.Clear(); if (!m_RevertList.GetStatus(&m_pathList)) { m_RevertList.SetEmptyString(m_RevertList.GetLastErrorMessage()); } m_RevertList.Show(GITSLC_SHOWVERSIONEDBUTNORMALANDEXTERNALSFROMDIFFERENTREPOS | GITSLC_SHOWDIRECTFILES | GITSLC_SHOWEXTERNALFROMDIFFERENTREPO, // do not select all files, only the ones the user has selected directly GITSLC_SHOWDIRECTFILES|GITSLC_SHOWADDED); if (m_RevertList.HasUnversionedItems()) { if (DWORD(CRegStdDWORD(_T("Software\\TortoiseGit\\UnversionedAsModified"), FALSE))) { GetDlgItem(IDC_UNVERSIONEDITEMS)->ShowWindow(SW_SHOW); } else GetDlgItem(IDC_UNVERSIONEDITEMS)->ShowWindow(SW_HIDE); } else GetDlgItem(IDC_UNVERSIONEDITEMS)->ShowWindow(SW_HIDE); InterlockedExchange(&m_bThreadRunning, FALSE); RefreshCursor(); return 0; }
LRESULT CFileDiffDlg::OnDiffFinished(WPARAM, LPARAM) { CString sFilterText; m_cFilter.GetWindowText(sFilterText); m_cFileList.SetRedraw(false); Filter(sFilterText); if (!m_arFileList.IsEmpty()) { // Highlight first entry in file list m_cFileList.SetSelectionMark(0); m_cFileList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); } int mincol = 0; int maxcol = m_cFileList.GetHeaderCtrl()->GetItemCount() - 1; int col; for (col = mincol; col <= maxcol; ++col) { m_cFileList.SetColumnWidth(col, LVSCW_AUTOSIZE_USEHEADER); } m_cFileList.ClearText(); if (m_arFileList.IsEmpty()) m_cFileList.ShowText(CString(MAKEINTRESOURCE(IDS_COMPAREREV_NODIFF))); m_cFileList.SetRedraw(true); InvalidateRect(NULL); RefreshCursor(); EnableInputControl(true); return 0; }
UINT CFileDiffDlg::DiffThread() { bool bSuccess = true; RefreshCursor(); m_cFileList.ShowText(CString(MAKEINTRESOURCE(IDS_FILEDIFF_WAIT))); m_arFileList.clear(); if (m_bDoPegDiff) { bSuccess = DiffSummarizePeg(m_path1, m_peg, m_rev1, m_rev2, m_depth, m_bIgnoreancestry); } else { bSuccess = DiffSummarize(m_path1, m_rev1, m_path2, m_rev2, m_depth, m_bIgnoreancestry); } if (!bSuccess) { m_cFileList.ShowText(GetLastErrorMessage()); InterlockedExchange(&m_bThreadRunning, FALSE); return 0; } CString sFilterText; m_cFilter.GetWindowText(sFilterText); m_cFileList.SetRedraw(false); Filter(sFilterText); if (! m_arFileList.empty()) { // Highlight first entry in file list m_cFileList.SetSelectionMark(0); m_cFileList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); } CRect rect; m_cFileList.GetClientRect(&rect); m_cFileList.SetColumnWidth(0, rect.Width()-100); m_cFileList.SetColumnWidth(1, 100); m_cFileList.ClearText(); m_cFileList.SetRedraw(true); InterlockedExchange(&m_bThreadRunning, FALSE); InvalidateRect(NULL); RefreshCursor(); return 0; }
LRESULT CFileDiffDlg::OnDisableButtons(WPARAM, LPARAM) { RefreshCursor(); m_cFileList.ShowText(CString(MAKEINTRESOURCE(IDS_FILEDIFF_WAIT))); m_cFileList.DeleteAllItems(); m_arFileList.Clear(); EnableInputControl(false); return 0; }
/** BroadCast Mouse Move Event */ void EventMgr::MouseMove(unsigned short x, unsigned short y) { if (windows.size() == 0) { return; } if (!last_win_focused) { return; } GameControl *gc = core->GetGameControl(); if (gc) { // for scrolling gc->OnGlobalMouseMove(x, y); } std::vector< int>::iterator t; std::vector< Window*>::iterator m; for (t = topwin.begin(); t != topwin.end(); ++t) { m = windows.begin(); m += ( *t ); Window *win = *m; if (win == NULL) continue; if (!win->Visible) continue; if (( win->XPos <= x ) && ( win->YPos <= y )) { //Maybe we are on the window, let's check if (( win->XPos + win->Width >= x ) && ( win->YPos + win->Height >= y )) { //Yes, we are on the Window //Let's check if we have a Control under the Mouse Pointer Control* ctrl = win->GetControl( x, y, true ); //look for the low priority flagged controls (mostly static labels) if (ctrl == NULL) { ctrl = win->GetControl( x, y, false ); } if (win != last_win_over || ctrl != win->GetOver()) { // Remove tooltip if mouse moved to different control core->DisplayTooltip( 0, 0, NULL ); if (last_win_over) { last_win_over->OnMouseLeave( x, y ); } last_win_over = win; win->OnMouseEnter( x, y, ctrl ); } if (ctrl != NULL) { win->OnMouseOver( x, y ); } RefreshCursor(win->Cursor); return; } } //stop going further if (( *m )->Visible == WINDOW_FRONT) break; } core->DisplayTooltip( 0, 0, NULL ); }
UINT CChangedDlg::ChangedStatusThread() { InterlockedExchange(&m_bBlock, TRUE); g_Git.RefreshGitIndex(); m_bCanceled = false; SetDlgItemText(IDOK, CString(MAKEINTRESOURCE(IDS_MSGBOX_CANCEL))); DialogEnableWindow(IDC_REFRESH, FALSE); DialogEnableWindow(IDC_SHOWUNVERSIONED, FALSE); DialogEnableWindow(IDC_SHOWUNMODIFIED, FALSE); DialogEnableWindow(IDC_SHOWIGNORED, FALSE); DialogEnableWindow(IDC_SHOWUSERPROPS, FALSE); CString temp; m_FileListCtrl.Clear(); if (!m_FileListCtrl.GetStatus(&m_pathList, m_bRemote, m_bShowIgnored != FALSE, m_bShowUnversioned != FALSE)) { if (!m_FileListCtrl.GetLastErrorMessage().IsEmpty()) m_FileListCtrl.SetEmptyString(m_FileListCtrl.GetLastErrorMessage()); } unsigned int dwShow = GITSLC_SHOWVERSIONEDBUTNORMALANDEXTERNALS | GITSLC_SHOWLOCKS | GITSLC_SHOWSWITCHED | GITSLC_SHOWINCHANGELIST; dwShow |= m_bShowUnversioned ? GITSLC_SHOWUNVERSIONED : 0; dwShow |= m_iShowUnmodified ? GITSLC_SHOWNORMAL : 0; dwShow |= m_bShowIgnored ? GITSLC_SHOWIGNORED : 0; dwShow |= m_bShowExternals ? GITSLC_SHOWEXTERNAL | GITSLC_SHOWINEXTERNALS | GITSLC_SHOWEXTERNALFROMDIFFERENTREPO : 0; m_FileListCtrl.Show(dwShow); UpdateStatistics(); bool bIsDirectory = false; CTGitPath commonDir = m_FileListCtrl.GetCommonDirectory(false); if (m_pathList.GetCount() == 1) { if (m_pathList[0].IsEmpty()) CAppUtils::SetWindowTitle(m_hWnd, g_Git.m_CurrentDir, m_sTitle); else CAppUtils::SetWindowTitle(m_hWnd, (g_Git.m_CurrentDir + _T("\\") + m_pathList[0].GetWinPathString()).TrimRight('\\'), m_sTitle); bIsDirectory = m_pathList[0].IsDirectory() || m_pathList[0].IsEmpty(); // if it is empty it is g_Git.m_CurrentDir which is a directory } else CAppUtils::SetWindowTitle(m_hWnd, commonDir.GetWinPathString(), m_sTitle); SetDlgItemText(IDOK, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK))); DialogEnableWindow(IDC_REFRESH, TRUE); DialogEnableWindow(IDC_SHOWUNVERSIONED, bIsDirectory); //DialogEnableWindow(IDC_SHOWUNMODIFIED, bIsDirectory); DialogEnableWindow(IDC_SHOWIGNORED, bIsDirectory); DialogEnableWindow(IDC_SHOWUSERPROPS, TRUE); InterlockedExchange(&m_bBlock, FALSE); // revert the remote flag back to the default m_bRemote = !!(DWORD)CRegDWORD(_T("Software\\TortoiseGit\\CheckRepo"), FALSE); RefreshCursor(); return 0; }
void CXTPMouseManager::RemoveTrack(CXTPCommandBar* pTrack) { int nIndex = m_arrTracked.Find(pTrack); if (nIndex != -1) { m_arrTracked.RemoveAt(nIndex); } if (m_arrTracked.GetSize() == 0) { RefreshCursor(); } m_bIgnoreLButtonUp = FALSE; }
UINT CChangedDlg::ChangedStatusThread() { InterlockedExchange(&m_bBlock, TRUE); m_bCanceled = false; SetDlgItemText(IDOK, CString(MAKEINTRESOURCE(IDS_MSGBOX_CANCEL))); DialogEnableWindow(IDC_REFRESH, FALSE); DialogEnableWindow(IDC_CHECKREPO, FALSE); DialogEnableWindow(IDC_SHOWUNVERSIONED, FALSE); DialogEnableWindow(IDC_SHOWUNMODIFIED, FALSE); DialogEnableWindow(IDC_SHOWIGNORED, FALSE); DialogEnableWindow(IDC_SHOWUSERPROPS, FALSE); CString temp; if (!m_FileListCtrl.GetStatus(&m_pathList, m_bRemote, m_bShowIgnored != FALSE, m_bShowUnversioned,m_bShowUserProps != FALSE)) { if (!m_FileListCtrl.GetLastErrorMessage().IsEmpty()) m_FileListCtrl.SetEmptyString(m_FileListCtrl.GetLastErrorMessage()); } DWORD dwShow = SVNSLC_SHOWVERSIONEDBUTNORMALANDEXTERNALS | SVNSLC_SHOWLOCKS | SVNSLC_SHOWSWITCHED | SVNSLC_SHOWINCHANGELIST; dwShow |= m_bShowUnversioned ? SVNSLC_SHOWUNVERSIONED : 0; dwShow |= m_iShowUnmodified ? SVNSLC_SHOWNORMAL : 0; dwShow |= m_bShowIgnored ? SVNSLC_SHOWIGNORED : 0; dwShow |= m_bShowExternals ? SVNSLC_SHOWEXTERNAL | SVNSLC_SHOWINEXTERNALS | SVNSLC_SHOWEXTERNALFROMDIFFERENTREPO : 0; m_FileListCtrl.Show(dwShow); UpdateStatistics(); CTGitPath commonDir = m_FileListCtrl.GetCommonDirectory(false); bool bSingleFile = ((m_pathList.GetCount()==1)&&(!m_pathList[0].IsDirectory())); if (bSingleFile) SetWindowText(m_sTitle + _T(" - ") + m_pathList[0].GetWinPathString()); else SetWindowText(m_sTitle + _T(" - ") + commonDir.GetWinPathString()); SetDlgItemText(IDOK, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK))); DialogEnableWindow(IDC_REFRESH, TRUE); DialogEnableWindow(IDC_CHECKREPO, TRUE); DialogEnableWindow(IDC_SHOWUNVERSIONED, !bSingleFile); DialogEnableWindow(IDC_SHOWUNMODIFIED, !bSingleFile); DialogEnableWindow(IDC_SHOWIGNORED, !bSingleFile); DialogEnableWindow(IDC_SHOWUSERPROPS, TRUE); InterlockedExchange(&m_bBlock, FALSE); // revert the remote flag back to the default m_bRemote = !!(DWORD)CRegDWORD(_T("Software\\TortoiseGit\\CheckRepo"), FALSE); RefreshCursor(); return 0; }
UINT CChangedDlg::ChangedStatusThread() { InterlockedExchange(&m_bBlock, TRUE); g_Git.RefreshGitIndex(); m_bCanceled = false; SetDlgItemText(IDOK, CString(MAKEINTRESOURCE(IDS_MSGBOX_CANCEL))); DialogEnableWindow(IDC_REFRESH, FALSE); DialogEnableWindow(IDC_SHOWUNVERSIONED, FALSE); DialogEnableWindow(IDC_SHOWUNMODIFIED, FALSE); DialogEnableWindow(IDC_SHOWIGNORED, FALSE); DialogEnableWindow(IDC_SHOWLOCALCHANGESIGNORED, FALSE); CString temp; m_FileListCtrl.Clear(); if (!m_FileListCtrl.GetStatus(m_bWholeProject ? nullptr : &m_pathList, m_bRemote, m_bShowIgnored != FALSE, m_bShowUnversioned != FALSE, m_bShowLocalChangesIgnored != FALSE)) { if (!m_FileListCtrl.GetLastErrorMessage().IsEmpty()) m_FileListCtrl.SetEmptyString(m_FileListCtrl.GetLastErrorMessage()); } unsigned int dwShow = GITSLC_SHOWVERSIONEDBUTNORMALANDEXTERNALS | GITSLC_SHOWLOCKS | GITSLC_SHOWSWITCHED | GITSLC_SHOWINCHANGELIST; dwShow |= m_bShowUnversioned ? GITSLC_SHOWUNVERSIONED : 0; dwShow |= m_iShowUnmodified ? GITSLC_SHOWNORMAL : 0; dwShow |= m_bShowIgnored ? GITSLC_SHOWIGNORED : 0; dwShow |= m_bShowLocalChangesIgnored ? GITSLC_SHOWASSUMEVALID | GITSLC_SHOWSKIPWORKTREE : 0; m_FileListCtrl.Show(dwShow); UpdateStatistics(); SetDlgTitle(); bool bIsDirectory = false; if (m_pathList.GetCount() == 1) bIsDirectory = m_pathList[0].IsDirectory() || m_pathList[0].IsEmpty(); // if it is empty it is g_Git.m_CurrentDir which is a directory SetDlgItemText(IDOK, CString(MAKEINTRESOURCE(IDS_MSGBOX_OK))); DialogEnableWindow(IDC_REFRESH, TRUE); DialogEnableWindow(IDC_SHOWUNVERSIONED, bIsDirectory); //DialogEnableWindow(IDC_SHOWUNMODIFIED, bIsDirectory); DialogEnableWindow(IDC_SHOWIGNORED, bIsDirectory); DialogEnableWindow(IDC_SHOWLOCALCHANGESIGNORED, TRUE); InterlockedExchange(&m_bBlock, FALSE); // revert the remote flag back to the default m_bRemote = !!(DWORD)CRegDWORD(_T("Software\\TortoiseGit\\CheckRepo"), FALSE); RefreshCursor(); return 0; }
LRESULT CGitProgressDlg::OnCmdEnd(WPARAM /*wParam*/, LPARAM /*lParam*/) { RefreshCursor(); DialogEnableWindow(IDCANCEL, FALSE); DialogEnableWindow(IDOK, TRUE); m_PostCmdList.clear(); if (m_ProgList.m_Command->m_PostCmdCallback) m_ProgList.m_Command->m_PostCmdCallback(m_ProgList.DidErrorsOccur() ? 1 : 0, m_PostCmdList); if (!m_PostCmdList.empty()) { int i = 0; for (const auto& entry : m_PostCmdList) { ++i; m_cMenuButton.AddEntry(entry.icon, entry.label); TCHAR accellerator = CStringUtils::GetAccellerator(entry.label); if (accellerator == L'\0') continue; ++m_accellerators[accellerator].cnt; if (m_accellerators[accellerator].cnt > 1) m_accellerators[accellerator].id = -1; else m_accellerators[accellerator].id = i - 1; } if (m_accellerators.size()) { LPACCEL lpaccelNew = (LPACCEL)LocalAlloc(LPTR, m_accellerators.size() * sizeof(ACCEL)); SCOPE_EXIT { LocalFree(lpaccelNew); }; i = 0; for (auto& entry : m_accellerators) { lpaccelNew[i].cmd = (WORD)(WM_USER + 1 + entry.second.id); lpaccelNew[i].fVirt = FVIRTKEY | FALT; lpaccelNew[i].key = entry.first; entry.second.wmid = lpaccelNew[i].cmd; ++i; } m_hAccel = CreateAcceleratorTable(lpaccelNew, (int)m_accellerators.size()); }
UINT CRevertDlg::RevertThread() { InterlockedExchange(&m_bThreadRunning, TRUE); // get the status of all selected file/folders recursively // and show the ones which can be reverted to the user // in a list control. DialogEnableWindow(ID_OK, false); m_bCancelled = false; if (!m_RevertList.GetStatus(m_pathList)) { m_RevertList.SetEmptyString(m_RevertList.GetLastErrorMessage()); } m_RevertList.Show(SVNSLC_SHOWVERSIONEDBUTNORMALANDEXTERNALSFROMDIFFERENTREPOS | SVNSLC_SHOWDIRECTFILES | SVNSLC_SHOWEXTERNALFROMDIFFERENTREPO | SVNSLC_SHOWNESTED, CTSVNPathList(), // do not select all files, only the ones the user has selected directly SVNSLC_SHOWDIRECTFILES | SVNSLC_SHOWADDED | SVNSLC_SHOWADDEDINADDED, true, true); CTSVNPath commonDir = m_RevertList.GetCommonDirectory(false); CAppUtils::SetWindowTitle(m_hWnd, commonDir.GetWinPathString(), m_sWindowTitle); if (m_RevertList.HasUnversionedItems()) { if (DWORD(CRegStdDWORD(L"Software\\TortoiseSVN\\UnversionedAsModified", FALSE))) { GetDlgItem(IDC_UNVERSIONEDITEMS)->ShowWindow(SW_SHOW); } else GetDlgItem(IDC_UNVERSIONEDITEMS)->ShowWindow(SW_HIDE); } else GetDlgItem(IDC_UNVERSIONEDITEMS)->ShowWindow(SW_HIDE); InterlockedExchange(&m_bThreadRunning, FALSE); RefreshCursor(); return 0; }
UINT CDeleteUnversionedDlg::StatusThread() { // get the status of all selected file/folders recursively // and show the ones which are unversioned/ignored to the user // in a list control. DialogEnableWindow(IDOK, false); m_bCancelled = false; if (!m_StatusList.GetStatus(m_pathList, false, true)) { m_StatusList.SetEmptyString(m_StatusList.GetLastErrorMessage()); } m_StatusList.Show(SVNSLC_SHOWUNVERSIONED | SVNSLC_SHOWIGNORED, CTSVNPathList(), SVNSLC_SHOWUNVERSIONED | SVNSLC_SHOWIGNORED, true, true); CTSVNPath commonDir = m_StatusList.GetCommonDirectory(false); CAppUtils::SetWindowTitle(m_hWnd, commonDir.GetWinPathString(), m_sWindowTitle); InterlockedExchange(&m_bThreadRunning, FALSE); RefreshCursor(); return 0; }
UINT CLockDlg::StatusThread() { // get the status of all selected file/folders recursively // and show the ones which can be locked to the user // in a list control. m_bBlock = TRUE; DialogEnableWindow(IDOK, false); m_bCancelled = false; // Initialise the list control with the status of the files/folders below us if (!m_cFileList.GetStatus(m_pathList)) { m_cFileList.SetEmptyString(m_cFileList.GetLastErrorMessage()); } DWORD dwShow = SVNSLC_SHOWNORMAL | SVNSLC_SHOWMODIFIED | SVNSLC_SHOWMERGED | SVNSLC_SHOWLOCKS | SVNSLC_SHOWINEXTERNALS; m_cFileList.Show(dwShow, CTSVNPathList(), dwShow, false, true); RefreshCursor(); CString logmsg; GetDlgItemText(IDC_LOCKMESSAGE, logmsg); DialogEnableWindow(IDOK, m_ProjectProperties ? m_ProjectProperties->nMinLockMsgSize <= logmsg.GetLength() : TRUE); m_bBlock = FALSE; return 0; }
/** BroadCast Mouse Move Event */ void EventMgr::MouseDown(unsigned short x, unsigned short y, unsigned short Button, unsigned short Mod) { std::vector< int>::iterator t; std::vector< Window*>::iterator m; Control *ctrl; unsigned long thisTime; thisTime = GetTickCount(); if (ClickMatch(x, y, thisTime)) { Button |= GEM_MB_DOUBLECLICK; dc_x = 0; dc_y = 0; dc_time = 0; } else { dc_x = x; dc_y = y; dc_time = thisTime+dc_delay; } MButtons |= Button; for (t = topwin.begin(); t != topwin.end(); ++t) { m = windows.begin(); m += ( *t ); if (( *m ) == NULL) continue; if (!( *m )->Visible) continue; if (( ( *m )->XPos <= x ) && ( ( *m )->YPos <= y )) { //Maybe we are on the window, let's check if (( ( *m )->XPos + ( *m )->Width >= x ) && ( ( *m )->YPos + ( *m )->Height >= y )) { //Yes, we are on the Window //Let's check if we have a Control under the Mouse Pointer ctrl = ( *m )->GetControl( x, y, true ); if (!ctrl) { ctrl = ( *m )->GetControl( x, y, false); } last_win_mousefocused = *m; if (ctrl != NULL) { last_win_mousefocused->SetMouseFocused( ctrl ); ctrl->OnMouseDown( x - last_win_mousefocused->XPos - ctrl->XPos, y - last_win_mousefocused->YPos - ctrl->YPos, Button, Mod ); if (!ctrl->WantsDragOperation()) { focusLock = ctrl; } if (last_win_mousefocused) { RefreshCursor(last_win_mousefocused->Cursor); } return; } } } if (( *m )->Visible == WINDOW_FRONT) //stop looking further break; } if ((Button == GEM_MB_SCRLUP || Button == GEM_MB_SCRLDOWN) && last_win_mousefocused) { ctrl = last_win_mousefocused->GetScrollControl(); if (ctrl) { ctrl->OnMouseDown( x - last_win_mousefocused->XPos - ctrl->XPos, y - last_win_mousefocused->YPos - ctrl->YPos, Button, Mod ); } } if (last_win_mousefocused) { last_win_mousefocused->SetMouseFocused(NULL); } }
void Window::Draw() { if (!visible) return; if (width <= 0 || height <= 0) return; if (x < -width || x > DisplayUi->GetWidth() || y < -height || y > DisplayUi->GetHeight()) return; if (windowskin) { if (width > 4 && height > 4 && (back_opacity * opacity / 255 > 0)) { if (background_needs_refresh) RefreshBackground(); if (animation_frames > 0) { int ianimation_count = (int)animation_count; Rect src_rect(0, height / 2 - ianimation_count, width, ianimation_count * 2); background->BlitScreen(x, y + src_rect.y, src_rect); } else { background->BlitScreen(x, y); } } if (width > 0 && height > 0 && opacity > 0) { if (frame_needs_refresh) RefreshFrame(); if (animation_frames > 0) { int ianimation_count = (int)animation_count; if (ianimation_count > 8) { Rect src_rect(0, height / 2 - ianimation_count, 8, ianimation_count * 2 - 16); frame_left->BlitScreen(x, y + 8 + src_rect.y, src_rect); frame_right->BlitScreen(x + width - 8, y + 8 + src_rect.y, src_rect); frame_up->BlitScreen(x, y + height / 2 - ianimation_count); frame_down->BlitScreen(x, y + height / 2 + ianimation_count - 8); } else { frame_up->BlitScreen(x, y + height / 2 - ianimation_count, Rect(0, 0, width, ianimation_count)); frame_down->BlitScreen(x, y + height / 2, Rect(0, 8 - ianimation_count, width, ianimation_count)); } } else { frame_up->BlitScreen(x, y); frame_down->BlitScreen(x, y + height - 8); frame_left->BlitScreen(x, y + 8); frame_right->BlitScreen(x + width - 8, y + 8); } } if (width > 16 && height > 16 && cursor_rect.width > 4 && cursor_rect.height > 4 && animation_frames == 0) { if (cursor_needs_refresh) RefreshCursor(); Rect src_rect( -min(cursor_rect.x + border_x, 0), -min(cursor_rect.y + border_y, 0), min(cursor_rect.width, width - cursor_rect.x + border_x), min(cursor_rect.height, height - cursor_rect.y + border_y) ); if (cursor_frame < 16) cursor1->BlitScreen(x + cursor_rect.x + border_x, y + cursor_rect.y + border_y, src_rect); else cursor2->BlitScreen(x + cursor_rect.x + border_x, y + cursor_rect.y + border_y, src_rect); } } if (contents) { if (width > 2 * border_x && height > 2 * border_y && -ox < width - 2 * border_x && -oy < height - 2 * border_y && contents_opacity > 0 && animation_frames == 0) { Rect src_rect(-min(-ox, 0), -min(-oy, 0), min(width - 2 * border_x, width - 2 * border_x + ox), min(height - 2 * border_y, height - 2 * border_y + oy)); contents_screen->SetOpacityEffect(contents_opacity); contents_screen->BlitScreen(max(x + border_x, x + border_x - ox), max(y + border_y, y + border_y - oy), src_rect); } } if (pause && pause_frame > 16 && animation_frames <= 0) { Rect src_rect(40, 16, 16, 8); windowskin_screen->BlitScreen(x + width / 2 - 8, y + height - 8, src_rect); } if (up_arrow) { Rect src_rect(40, 8, 16, 8); windowskin_screen->BlitScreen(x + width / 2 - 8, y, src_rect); } if (down_arrow) { Rect src_rect(40, 16, 16, 8); windowskin_screen->BlitScreen(x + width / 2 - 8, y + height - 8, src_rect); } if (animation_frames > 0) { // Open/Close Animation animation_frames -= 1; animation_count += animation_increment; if (closing && animation_frames <= 0) { visible = false; closing = false; } } }
UINT CFileDiffDlg::ExportThread() { RefreshCursor(); if (m_pProgDlg == NULL) return 1; long count = 0; SetAndClearProgressInfo(m_pProgDlg, false); m_pProgDlg->SetTitle(IDS_PROGRESSWAIT); m_pProgDlg->SetAnimation(AfxGetResourceHandle(), IDR_DOWNLOAD); m_pProgDlg->ShowModeless(this); for (INT_PTR i=0; (i<m_arSelectedFileList.GetCount())&&(!m_pProgDlg->HasUserCancelled()); ++i) { CFileDiffDlg::FileDiff fd = m_arSelectedFileList[i]; CTSVNPath url1 = CTSVNPath(m_path1.GetSVNPathString() + _T("/") + fd.path.GetSVNPathString()); CTSVNPath url2 = m_bDoPegDiff ? url1 : CTSVNPath(m_path2.GetSVNPathString() + _T("/") + fd.path.GetSVNPathString()); if ((fd.node == svn_node_dir)&&(fd.kind != svn_client_diff_summarize_kind_added)) { // just create the directory CreateDirectoryEx(NULL, m_strExportDir+_T("\\")+CPathUtils::PathUnescape(fd.path.GetWinPathString()), NULL); continue; } CString sTemp; m_pProgDlg->FormatPathLine(1, IDS_PROGRESSGETFILE, (LPCTSTR)url1.GetSVNPathString()); CTSVNPath savepath = CTSVNPath(m_strExportDir); savepath.AppendPathString(_T("\\") + CPathUtils::PathUnescape(fd.path.GetWinPathString())); CPathUtils::MakeSureDirectoryPathExists(fd.node == svn_node_file ? savepath.GetContainingDirectory().GetWinPath() : savepath.GetDirectory().GetWinPath()); if (fd.node == svn_node_dir) { // exporting a folder requires calling SVN::Export() so we also export all // children of that added folder. if ((fd.kind == svn_client_diff_summarize_kind_added)&&(!Export(url2, savepath, m_bDoPegDiff ? m_peg : m_rev2, m_rev2, true, true))) { if ((!m_bDoPegDiff)||(!Export(url2, savepath, m_rev2, m_rev2, true, true))) { delete m_pProgDlg; m_pProgDlg = NULL; CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); InterlockedExchange(&m_bThreadRunning, FALSE); RefreshCursor(); return 1; } } } else { // exporting a file requires calling SVN::Cat(), since SVN::Export() only works // with folders. if ((fd.kind != svn_client_diff_summarize_kind_deleted)&&(!Cat(url2, m_bDoPegDiff ? m_peg : m_rev2, m_rev2, savepath))) { if ((!m_bDoPegDiff)||(!Cat(url2, m_rev2, m_rev2, savepath))) { delete m_pProgDlg; m_pProgDlg = NULL; CMessageBox::Show(this->m_hWnd, GetLastErrorMessage(), _T("TortoiseSVN"), MB_ICONERROR); InterlockedExchange(&m_bThreadRunning, FALSE); RefreshCursor(); return 1; } } } count++; m_pProgDlg->SetProgress (count, static_cast<DWORD>(m_arSelectedFileList.GetCount())); } m_pProgDlg->Stop(); SetAndClearProgressInfo(NULL, false); delete m_pProgDlg; m_pProgDlg = NULL; InterlockedExchange(&m_bThreadRunning, FALSE); RefreshCursor(); return 0; }
BOOL GetLWEvent (int event, PLWEVENT lwe) { static int timeout_count = 0; static LWEVENT old_lwe = {0, 0}; int nr_keys = 0; unsigned int interval; int button; PMOUSEEVENT me = &(lwe->data.me); PKEYEVENT ke = &(lwe->data.ke); const char* keystate; int i; int make; /* 0 = release, 1 = presse */ if (event & IAL_MOUSEEVENT) { if (!IAL_UpdateMouse ()) event &= ~IAL_MOUSEEVENT; } if (event & IAL_KEYEVENT) { if ((nr_keys = IAL_UpdateKeyboard ()) == 0) event &= ~IAL_KEYEVENT; } if (event == 0) { if (__mg_event_timeout.tv_sec == 0 && __mg_event_timeout.tv_usec == 0) { // set repeat time __mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_usec = repeatusec; // repeat last event if (old_lwe.type == LWETYPE_KEY && old_lwe.data.ke.event == KE_KEYDOWN) { memcpy (lwe, &old_lwe, sizeof (LWEVENT)); lwe->data.ke.status |= KS_REPEATED; return 1; } if (!(old_lwe.type == LWETYPE_MOUSE && (old_lwe.data.me.event == ME_LEFTDOWN || old_lwe.data.me.event == ME_RIGHTDOWN || old_lwe.data.me.event == ME_MIDDLEDOWN))) { // reset delay time __mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_usec = timeoutusec; } lwe->type = LWETYPE_TIMEOUT; lwe->count = ++timeout_count; return 1; } old_lwe.type = 0; return 0; } timeout_count = 0; /* There was an event occurred. */ if (event & IAL_MOUSEEVENT) { lwe->type = LWETYPE_MOUSE; if (RefreshCursor(&me->x, &me->y, &button)) { me->event = ME_MOVED; time1 = 0; time2 = 0; if (oldbutton == button) return 1; } if ( !(oldbutton & IAL_MOUSE_LEFTBUTTON) && (button & IAL_MOUSE_LEFTBUTTON) ) { if (time1) { interval = __mg_timer_counter - time1; if (interval <= dblclicktime) me->event = ME_LEFTDBLCLICK; else me->event = ME_LEFTDOWN; time1 = 0; } else { time1 = __mg_timer_counter; me->event = ME_LEFTDOWN; } goto mouseret; } if ( (oldbutton & IAL_MOUSE_LEFTBUTTON) && !(button & IAL_MOUSE_LEFTBUTTON) ) { me->event = ME_LEFTUP; goto mouseret; } if ( !(oldbutton & IAL_MOUSE_RIGHTBUTTON) && (button & IAL_MOUSE_RIGHTBUTTON) ) { if (time2) { interval = __mg_timer_counter - time2; if (interval <= dblclicktime) me->event = ME_RIGHTDBLCLICK; else me->event = ME_RIGHTDOWN; time2 = 0; } else { time2 = __mg_timer_counter; me->event = ME_RIGHTDOWN; } goto mouseret; } if ( (oldbutton & IAL_MOUSE_RIGHTBUTTON) && !(button & IAL_MOUSE_RIGHTBUTTON) ) { me->event = ME_RIGHTUP; goto mouseret; } } if (event & IAL_KEYEVENT) { lwe->type = LWETYPE_KEY; keystate = IAL_GetKeyboardState (); for (i = 1; i < nr_keys; i++) { if(!oldkeystate[i] && keystate[i]) { ke->event = KE_KEYDOWN; ke_time =__mg_timer_counter; ke->scancode = i; olddownkey = i; break; } if(oldkeystate[i] && !keystate[i]) { ke->event = KE_KEYUP; ke->scancode = i; break; } } if (i == nr_keys) { if (olddownkey == 0) return 0; ke->scancode = olddownkey; interval = __mg_timer_counter - ke_time; treat_longpress (ke, interval); if (ke->event == 0) return 0; } make = (ke->event == KE_KEYDOWN) ? 1 : 0; if (i != nr_keys) { unsigned leds; switch (ke->scancode) { case SCANCODE_CAPSLOCK: if (make && caps_off) { capslock = 1 - capslock; leds = slock | (numlock << 1) | (capslock << 2); IAL_SetLeds (leds); status = (DWORD)leds << 16; } caps_off = 1 - make; break; case SCANCODE_NUMLOCK: if (make && num_off) { numlock = 1 - numlock; leds = slock | (numlock << 1) | (capslock << 2); IAL_SetLeds (leds); status = (DWORD)leds << 16; } num_off = 1 - make; break; case SCANCODE_SCROLLLOCK: if (make & slock_off) { slock = 1 - slock; leds = slock | (numlock << 1) | (capslock << 2); IAL_SetLeds (leds); status = (DWORD)leds << 16; } slock_off = 1 - make; break; case SCANCODE_LEFTCONTROL: control1 = make; break; case SCANCODE_RIGHTCONTROL: control2 = make; break; case SCANCODE_LEFTSHIFT: shift1 = make; break; case SCANCODE_RIGHTSHIFT: shift2 = make; break; case SCANCODE_LEFTALT: alt1 = make; break; case SCANCODE_RIGHTALT: alt2 = make; break; } status &= ~(MASK_KS_SHIFTKEYS); status |= (DWORD)((capslock << 8) | (numlock << 7) | (slock << 6) | (control1 << 5) | (control2 << 4) | (alt1 << 3) | (alt2 << 2) | (shift1 << 1) | (shift2)); // Mouse button status if (oldbutton & IAL_MOUSE_LEFTBUTTON) status |= KS_LEFTBUTTON; else if (oldbutton & IAL_MOUSE_RIGHTBUTTON) status |= KS_RIGHTBUTTON; } ke->status = status; memcpy (oldkeystate, keystate, nr_keys); memcpy (&old_lwe, lwe, sizeof (LWEVENT)); __mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_usec = timeoutusec; return 1; } old_lwe.type = 0; return 0; mouseret: status &= ~(MASK_KS_BUTTONS); oldbutton = button; if (oldbutton & IAL_MOUSE_LEFTBUTTON) status |= KS_LEFTBUTTON; if (oldbutton & IAL_MOUSE_RIGHTBUTTON) status |= KS_RIGHTBUTTON; me->status = status; memcpy (&old_lwe, lwe, sizeof (LWEVENT)); __mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_usec = timeoutusec; return 1; }