IDR_MAINFRAME ACCELERATORS FIXED IMPURE
BEGIN
"A", ID_EDIT_SELECT_ALL, VIRTKEY, CONTROL, NOINVERT
- "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
- "F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
- "H", ID_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT
- "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
- "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
- "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
- "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
- "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
+ "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
+ "F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
+ "H", ID_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT
+ "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
+ "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
+ "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
+ "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
+ "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
"Y", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
- VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
- VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
- VK_DOWN, ID_NEXTDIFF, VIRTKEY, ALT, NOINVERT
- VK_END, ID_LASTDIFF, VIRTKEY, ALT, NOINVERT
- VK_F3, ID_EDIT_REPEAT, VIRTKEY, NOINVERT
- VK_F3, ID_EDIT_FIND_PREVIOUS, VIRTKEY, SHIFT, NOINVERT
+ VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
+ VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
+ VK_DOWN, ID_NEXTDIFF, VIRTKEY, ALT, NOINVERT
+ VK_END, ID_LASTDIFF, VIRTKEY, ALT, NOINVERT
+ VK_F3, ID_EDIT_REPEAT, VIRTKEY, NOINVERT
+ VK_F3, ID_EDIT_FIND_PREVIOUS, VIRTKEY, SHIFT, NOINVERT
VK_F4, ID_SHOWLINEDIFF, VIRTKEY, NOINVERT
- VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
- VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
- VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
- VK_HOME, ID_FIRSTDIFF, VIRTKEY, ALT, NOINVERT
- VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
- VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
- VK_LEFT, ID_R2L, VIRTKEY, ALT, NOINVERT
- VK_RETURN, ID_CURDIFF, VIRTKEY, ALT, NOINVERT
- VK_RIGHT, ID_L2R, VIRTKEY, ALT, NOINVERT
- VK_UP, ID_PREVDIFF, VIRTKEY, ALT, NOINVERT
+ VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
+ VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
+ VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
+ VK_HOME, ID_FIRSTDIFF, VIRTKEY, ALT, NOINVERT
+ VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
+ VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
+ VK_LEFT, ID_R2L, VIRTKEY, ALT, NOINVERT
+ VK_RETURN, ID_CURDIFF, VIRTKEY, ALT, NOINVERT
+ VK_RIGHT, ID_L2R, VIRTKEY, ALT, NOINVERT
+ VK_UP, ID_PREVDIFF, VIRTKEY, ALT, NOINVERT
END
IDS_FILESSAME "Ñ¡ÔñµÄÎļþÍêÈ«Ïàͬ¡£"
IDS_FILEUNIQUE "Ñ¡ÔñµÄÎļþ²»´æÔÚÓÚÁ½±ßµÄÎļþ¼Ð£¬Òò´ËÎÞ·¨±È¶Ô¡£"
IDS_FILEERROR "Ò»¸ö´íÎó·¢ÉúÓڱȶÔÎļþʱ¡£"
- IDS_SAVEREADONLY_FMT "%1 ±ê¼ÇΪֻ¶Á¡£ ÄúÒªÒÔÒ»¸ö²»Í¬µÄúû³Æ±£´æÎļþÂð£¿"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "±£´æ¸ü¸Äµ½ %1£¿"
IDS_FILEBINARY "¶þ½øÖÆÎļþÎÞ·¨×÷ÊÓ¾õµÄ±È¶Ô¡£"
IDS_SAVEVSS_FMT "%1 ±ê¼ÇΪֻ¶Á¡£ ÄúÒª´Ó°æ±¾ÏµÍ³¼ì²éËü£¬»¹ÊÇÒÔÒ»¸ö²»Í¬µÄÃû³Æ±£´æËü£¿"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDR_MAINFRAME ACCELERATORS FIXED IMPURE
BEGIN
"A", ID_EDIT_SELECT_ALL, VIRTKEY, CONTROL, NOINVERT
- "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
- "F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
- "H", ID_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT
- "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
- "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
- "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
- "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
- "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
+ "C", ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
+ "F", ID_EDIT_FIND, VIRTKEY, CONTROL, NOINVERT
+ "H", ID_EDIT_REPLACE, VIRTKEY, CONTROL, NOINVERT
+ "N", ID_FILE_NEW, VIRTKEY, CONTROL, NOINVERT
+ "O", ID_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
+ "P", ID_FILE_PRINT, VIRTKEY, CONTROL, NOINVERT
+ "S", ID_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
+ "V", ID_EDIT_PASTE, VIRTKEY, CONTROL, NOINVERT
"X", ID_EDIT_CUT, VIRTKEY, CONTROL, NOINVERT
"Y", ID_EDIT_REDO, VIRTKEY, CONTROL, NOINVERT
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL, NOINVERT
- VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
- VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
- VK_DOWN, ID_NEXTDIFF, VIRTKEY, ALT, NOINVERT
- VK_END, ID_LASTDIFF, VIRTKEY, ALT, NOINVERT
- VK_F3, ID_EDIT_REPEAT, VIRTKEY, NOINVERT
- VK_F3, ID_EDIT_FIND_PREVIOUS, VIRTKEY, SHIFT, NOINVERT
+ VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT, NOINVERT
+ VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT, NOINVERT
+ VK_DOWN, ID_NEXTDIFF, VIRTKEY, ALT, NOINVERT
+ VK_END, ID_LASTDIFF, VIRTKEY, ALT, NOINVERT
+ VK_F3, ID_EDIT_REPEAT, VIRTKEY, NOINVERT
+ VK_F3, ID_EDIT_FIND_PREVIOUS, VIRTKEY, SHIFT, NOINVERT
VK_F4, ID_SHOWLINEDIFF, VIRTKEY, NOINVERT
- VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
- VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
- VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
- VK_HOME, ID_FIRSTDIFF, VIRTKEY, ALT, NOINVERT
- VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
- VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
- VK_LEFT, ID_R2L, VIRTKEY, ALT, NOINVERT
- VK_RETURN, ID_CURDIFF, VIRTKEY, ALT, NOINVERT
- VK_RIGHT, ID_L2R, VIRTKEY, ALT, NOINVERT
- VK_UP, ID_PREVDIFF, VIRTKEY, ALT, NOINVERT
+ VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
+ VK_F6, ID_NEXT_PANE, VIRTKEY, NOINVERT
+ VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT
+ VK_HOME, ID_FIRSTDIFF, VIRTKEY, ALT, NOINVERT
+ VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL, NOINVERT
+ VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT, NOINVERT
+ VK_LEFT, ID_R2L, VIRTKEY, ALT, NOINVERT
+ VK_RETURN, ID_CURDIFF, VIRTKEY, ALT, NOINVERT
+ VK_RIGHT, ID_L2R, VIRTKEY, ALT, NOINVERT
+ VK_UP, ID_PREVDIFF, VIRTKEY, ALT, NOINVERT
END
IDS_FILESSAME "¿ï¨úªºÀɮק¹¥þ¬Û¦P¡C"
IDS_FILEUNIQUE "¿ï¨úªºÀɮפ£¦s¦b©ó¨âÃ䪺¸ê®Æ§¨¡A¦]¦¹µLªk¤ñ¹ï¡C"
IDS_FILEERROR "¤@Ó¿ù»~µo¥Í©ó¤ñ¹ïÀɮ׮ɡC"
- IDS_SAVEREADONLY_FMT "%1 ¼Ð°O¬°°ßŪ¡C §An¥H¤@Ó¤£¦Pªº¦WºÙÀx¦sÀɮ׶ܡH"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Àx¦s§ó§ï¨ì %1¡H"
IDS_FILEBINARY "¤G¶i¨îÀÉ®×µLªk§@µøıªº¤ñ¹ï¡C"
IDS_SAVEVSS_FMT "%1 ¼Ð°O¬°°ßŪ¡C §An±qª©¥»¨t²ÎÀˬd¥¦¡AÁÙ¬O¥H¤@Ó¤£¦Pªº¦WºÙÀx¦s¥¦¡H"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "Vybrané soubory jsou shodné."
IDS_FILEUNIQUE "Vybraný soubor neexistuje v obou adresáøích a nelze provést porovnání."
IDS_FILEERROR "Bìhem porovnávání se vyskytla chyba."
- IDS_SAVEREADONLY_FMT "%1 je oznaèen pouze ke ètení. Chcete jej ulo\9eit pod jiným jménem?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Ulo\9eit zmìny do %1?"
IDS_FILEBINARY "Binární soubory nelze porovnat."
IDS_SAVEVSS_FMT "%1 je oznaèen pouze ke ètení. Chcete jej zkontrolovat pomocí SourceSafe nebo ulo\9eit pod jiným jménem?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "De valgte filer er identiske."
IDS_FILEUNIQUE "Den valgte fil eksistere ikke i begge mapper og kan derfor ikke sammenlignes"
IDS_FILEERROR "Der skete en fejl under sammenligning af filerne."
- IDS_SAVEREADONLY_FMT "%1 er markeret som skrivebeskyttet. Vil du gemme filen under et andet navn?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Gem ændringer til %1?"
IDS_FILEBINARY "Binære filer kan ikke sammenlignes visuelt."
IDS_SAVEVSS_FMT "%1 er markeret som skrivebeskyttet. Vil du checke filen ud fra et versionsstyringssystem, eller gemme den under et andet navn?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "De geselecteerde bestanden zijn identiek"
IDS_FILEUNIQUE "Het geselecteerde bestand bestaat slechts in een map en kon daarom niet vergeleken woren"
IDS_FILEERROR "Fout opgetreden tijdens het vergelijken van de bestanden"
- IDS_SAVEREADONLY_FMT "%1 mag alleen gelezen worden. Opslaan onder een andere naam?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Wijzigingen opslaan in %1?"
IDS_FILEBINARY "Binaire bestanden kunnen niet zichtbaar vergeleken worden."
IDS_SAVEVSS_FMT "%1 mag alleen gelezen worden. Wil u een check out vanuit SourceSafe doen, of opslaan met een andere naam?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "Les fichiers sélectionnés sont identiques."
IDS_FILEUNIQUE "Le fichier sélectionné n'existe pas dans les deux répertoires et ne peut donc pas être comparé."
IDS_FILEERROR "Erreur lors de la comparaison des fichiers."
- IDS_SAVEREADONLY_FMT "%1 est en lecture seule. Enregistrer le fichier sous un nouveau nom ?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Enregistrer les changements de %1 ?"
IDS_FILEBINARY "Les fichiers binaires ne peuvent pas être comparés de manière visuelle."
IDS_SAVEVSS_FMT "%1 est en lecture seule. Voulez-vous l'extraire de SourceSafe ou l'enregistrer sous un nouveau nom ?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "Die ausgewählten Dateien sind identisch."
IDS_FILEUNIQUE "\nDie ausgewählte Datei ist nicht in beiden Verzeichnissen vorhanden und konnte deshalb nicht verglichen werden."
IDS_FILEERROR "Beim Vergleichen der Dateien ist ein Fehler aufgetreten."
- IDS_SAVEREADONLY_FMT "%1 ist schreibgeschützt. Wollen Sie die Datei unter einem anderen Namen abspeichern?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Änderungen in %1 speichern?"
IDS_FILEBINARY "Binärdateien können nicht visuell verglichen werden."
IDS_SAVEVSS_FMT "%1 ist schreibgeschützt. Wollen Sie die Datei aus SourceSafe auschecken oder unter einem anderen Namen abspeichern?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "I file selezionati sono identici."
IDS_FILEUNIQUE "Il file selezionato è presente unicamente in una due cartelle e pertanto non può essere confrontato."
IDS_FILEERROR "Si è verificato un errore durante il confronto dei file."
- IDS_SAVEREADONLY_FMT "%1 è un file di sola lettura. Vuoi salvarlo con un nome differente?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Vuoi salvare le modifiche in %1?"
IDS_FILEBINARY "I file di tipo binario non possono essere confrontati visualmente."
IDS_SAVEVSS_FMT "%1 è un file di sola lettura. Vuoi estrarlo da SourceSafe, o salvarlo con un nome differente?"
// Microsoft Visual C++ generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "¼±ÅÃÇϽŠÆÄÀϵéÀº µ¿ÀÏÇÑ ³»¿ëÀÇ ÆÄÀϵéÀÔ´Ï´Ù.."
IDS_FILEUNIQUE "¼±ÅÃÇϽŠÆÄÀÏÀº ¾çÂÊ µð·ºÅ丮¿¡ ¸ðµÎ Á¸ÀçÇÏ´Â ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù."
IDS_FILEERROR "ÆÄÀÏ ºñ±³ µµÁß ¿¡·¯°¡ ¹ß»ýÇß½À´Ï´Ù."
- IDS_SAVEREADONLY_FMT "%1 Àº Àбâ Àü¿ë ÆÄÀÏÀÔ´Ï´Ù. ´Ù¸¥ À̸§À¸·Î ÀúÀåÇϽðڽÀ´Ï±î?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "%1 ÀÇ º¯°æµÈ ºÎºÐÀ» ÀúÀåÇϽðڽÀ´Ï±î?"
IDS_FILEBINARY "¹ÙÀ̳ʸ® ÆÄÀÏÀº ºñ±³ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù."
IDS_SAVEVSS_FMT "%1 Àº Àбâ Àü¿ë ÆÄÀÏÀÔ´Ï´Ù. ¹öÀü°ü¸®½Ã½ºÅÛ¿¡¼ üũ¾Æ¿ôÇϰųª ´Ù¸¥ À̸§À¸·Î ÀúÀåÇϽðڽÀ´Ï±î?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "Vybrané súbory sú rovnaké."
IDS_FILEUNIQUE "Vybraný súbor neexistuje v oboch adresároch, nedá sa porovna\9d."
IDS_FILEERROR "Poèas porovnávania sa vyskytla chyba."
- IDS_SAVEREADONLY_FMT "%1 je oznaèený len na èítanieí. Chcete ho ulo\9ei\9d pod iným menom?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Ulo\9ei\9d zmeny do %1?"
IDS_FILEBINARY "Binárne súbory nemo\9eno porovna\9d."
IDS_SAVEVSS_FMT "%1 je oznaèený len na èítanie. Chcete ho skontrolova\9d pomocou SourceSafe alebo ulo\9ei\9d pod iným menom?"
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "Los archivos indicados son iguales"
IDS_FILEUNIQUE "El archivo indicado no se existe en los dos directorios y por eso, no se puede comparar."
IDS_FILEERROR "Se ocurrió un error cuando estaba comparando los archivos"
- IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to save the file under a different name?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Guardar los cambios a %1?"
IDS_FILEBINARY "Archivos binarios no se puede comparar visualmente."
IDS_SAVEVSS_FMT "%1 is marked read-only. Would you like to check it out from SourceSafe, or save it under a different name?"
/////////////////////////////////////////////////////////////////////////////
// MainFrm.cpp : implementation of the CMainFrame class
//
+// $Id$
#include "stdafx.h"
#include "Merge.h"
ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWNORMAL);
}
+/**
+* @brief Check if file is read-only and save to version control if one is used.
+*
+*
+* @param strSavePath Path where to save including filename
+*
+* @return Tells if caller can continue (no errors happened)
+*
+* @note If user selects "Cancel" FALSE is returned and caller must assume file
+* is not saved.
+*
+* @sa SaveToVersionControl()
+*
+*/
BOOL CMainFrame::CheckSavePath(CString& strSavePath)
{
- BOOL needCheck;
CFileStatus status;
+ UINT userChoice = 0;
+ BOOL bRetVal = TRUE;
CString s;
- // check if file is writeable
- do
+ if (CFile::GetStatus(strSavePath, status))
{
- needCheck = FALSE;
- if (CFile::GetStatus(strSavePath, status))
+ // If file is read-only
+ if (status.m_attribute & CFile::Attribute::readOnly)
{
- if (status.m_attribute & CFile::Attribute::readOnly)
+ // Version control system used?
+ if (m_nVerSys > 0)
+ bRetVal = SaveToVersionControl(strSavePath);
+ else
{
- int userChoice = IDCANCEL;
-
- switch(m_nVerSys)
+ CString title;
+ VERIFY(title.LoadString(IDS_SAVE_AS_TITLE));
+
+ // Prompt for user choice
+ AfxFormatString1(s, IDS_SAVEREADONLY_FMT, strSavePath);
+ userChoice = AfxMessageBox(s, MB_YESNOCANCEL |
+ MB_ICONQUESTION | MB_DEFBUTTON2);
+ switch (userChoice)
{
- case 0: //no versioning system
- // prompt for user choice
- AfxFormatString1(s, IDS_SAVEREADONLY_FMT, strSavePath);
- if (AfxMessageBox(s, MB_YESNO|MB_ICONQUESTION) == IDYES)
- {
- userChoice = IDSAVEAS;
- }
+ // Overwrite read-only file
+ case IDYES:
+ status.m_mtime = 0; // Avoid unwanted changes
+ status.m_attribute &= ~CFile::Attribute::readOnly;
+ CFile::SetStatus(strSavePath, status);
break;
- case 1: // Visual Source Safe
- {
- // prompt for user choice
- CVssPrompt dlg;
- dlg.m_strMessage.FormatMessage(IDS_SAVE_FMT, strSavePath);
- dlg.m_strProject = m_strVssProject;
- dlg.m_strUser = m_strVssUser; // BSP - Add VSS user name to dialog box
- dlg.m_strPassword = m_strVssPassword;
- userChoice = dlg.DoModal();
- // process versioning system specific action
- if(userChoice==IDOK)
- {
- CWaitCursor wait;
- m_strVssProject = dlg.m_strProject;
- theApp.WriteProfileString(_T("Settings"), _T("VssProject"), mf->m_strVssProject);
- CString spath, sname;
- SplitFilename(strSavePath, &spath, &sname, 0);
- if (!spath.IsEmpty())
- {
- _chdrive(toupper(spath[0])-'A'+1);
- _chdir(spath);
- }
- CString args;
- args.Format(_T("checkout %s/%s"), m_strVssProject, sname);
- HANDLE hVss = RunIt(m_strVssPath, args, TRUE, FALSE);
- if (hVss!=INVALID_HANDLE_VALUE)
- {
- WaitForSingleObject(hVss, INFINITE);
- DWORD code;
- GetExitCodeProcess(hVss, &code);
- CloseHandle(hVss);
- if (code != 0)
- {
- AfxMessageBox(IDS_VSSERROR, MB_ICONSTOP);
- return FALSE;
- }
- needCheck=FALSE;
- }
- else
- {
- AfxMessageBox(IDS_VSS_RUN_ERROR, MB_ICONSTOP);
- return FALSE;
- }
- }
- }
+
+ // Save to new filename
+ case IDNO:
+ if (SelectFile(s, strSavePath, title, NULL, FALSE))
+ strSavePath = s;
+ else
+ bRetVal = FALSE;
+ break;
+
+ // Cancel saving
+ case IDCANCEL:
+ bRetVal = FALSE;
break;
- case 2: // CVisual SourceSafe 5.0+ (COM)
- {
- // prompt for user choice
- CVssPrompt dlg;
- dlg.m_strMessage.FormatMessage(IDS_SAVE_FMT, strSavePath);
- dlg.m_strProject = m_strVssProject;
- dlg.m_strUser = m_strVssUser; // BSP - Add VSS user name to dialog box
- dlg.m_strPassword = m_strVssPassword;
- userChoice = dlg.DoModal();
- // process versioning system specific action
- if(userChoice==IDOK)
- {
- CWaitCursor wait;
- m_strVssProject = dlg.m_strProject;
- m_strVssUser = dlg.m_strUser;
- m_strVssPassword = dlg.m_strPassword;
-
- theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_strVssProject);
- theApp.WriteProfileString(_T("Settings"), _T("VssUser"), m_strVssUser);
- theApp.WriteProfileString(_T("Settings"), _T("VssPassword"), m_strVssPassword);
-
- IVSSDatabase vssdb;
- IVSSItems m_vssis;
- IVSSItem m_vssi;
-
- COleException *eOleException = new COleException;
-
- // BSP - Create the COM interface pointer to VSS
- if (FAILED(vssdb.CreateDispatch("SourceSafe", eOleException)))
- {
- throw eOleException; // catch block deletes.
- }
- else
- {
- eOleException->Delete();
- }
-
- // BSP - Open the specific VSS data file using info from VSS dialog box
- vssdb.Open(m_strVssPath, m_strVssUser, m_strVssPassword);
-
- CString spath, sname;
- SplitFilename(strSavePath, &spath, &sname, 0);
-
- // BSP - Combine the project entered on the dialog box with the file name...
- CString strItem = m_strVssProject + '/' + sname;
-
- // BSP - ...to get the specific source safe item to be checked out
- m_vssi = vssdb.GetVSSItem( strItem, 0 );
-
- // BSP - Get the working directory where VSS will put the file...
- CString strLocalSpec = m_vssi.GetLocalSpec();
-
- // BSP - ...and compare it to the directory WinMerge is using.
- if (strLocalSpec.CompareNoCase(strSavePath))
- {
- // BSP - if the directories are different, let the user confirm the CheckOut
- int iRes = AfxMessageBox("The VSS Working Folder and the location of the current file do not match. Continue?", MB_YESNO);
-
- if (iRes != IDYES)
- return FALSE; // BSP - if not Yes, bail.
- }
-
- // BSP - Finally! Check out the file!
- m_vssi.Checkout("", strSavePath, 0);
- }
}
- break;
- case 3: // ClearCase
- {
- // prompt for user choice
- CCCPrompt dlg;
- userChoice = dlg.DoModal();
- // process versioning system specific action
- if(userChoice == IDOK)
- {
- CWaitCursor wait;
- CString spath, sname;
- SplitFilename(strSavePath, &spath, &sname, 0);
- if (!spath.IsEmpty())
- {
- _chdrive(toupper(spath[0])-'A'+1);
- _chdir(spath);
- }
- DWORD code;
- CString args;
- args.Format(_T("checkout -c \"%s\" %s"), dlg.m_comments, sname);
- HANDLE hVss = RunIt(m_strVssPath, args, TRUE, FALSE);
- if (hVss!=INVALID_HANDLE_VALUE)
- {
- WaitForSingleObject(hVss, INFINITE);
- GetExitCodeProcess(hVss, &code);
- CloseHandle(hVss);
-
- if (code != 0)
- {
- AfxMessageBox(IDS_VSSERROR, MB_ICONSTOP);
- return FALSE;
- }
- needCheck=FALSE;
- }
- else
- {
- AfxMessageBox(IDS_VSS_RUN_ERROR, MB_ICONSTOP);
- return FALSE;
- }
- }
- }
- break;
- } //switch(m_nVerSys)
-
- // common processing for all version systems
- switch(userChoice)
+ }
+ }
+ }
+ return bRetVal;
+}
+
+/**
+* @brief Saves file to selected version control system
+*
+* @param strSavePath Path where to save including filename
+*
+* @return Tells if caller can continue (no errors happened)
+*
+* @note
+*
+* @sa CheckSavePath()
+*
+*/
+BOOL CMainFrame::SaveToVersionControl(CString& strSavePath)
+{
+ CFileStatus status;
+ CString s;
+ UINT userChoice = 0;
+
+ switch(m_nVerSys)
+ {
+ case 0: //no versioning system
+ // Already handled in CheckSavePath()
+ break;
+ case 1: // Visual Source Safe
+ {
+ // prompt for user choice
+ CVssPrompt dlg;
+ dlg.m_strMessage.FormatMessage(IDS_SAVE_FMT, strSavePath);
+ dlg.m_strProject = m_strVssProject;
+ dlg.m_strUser = m_strVssUser; // BSP - Add VSS user name to dialog box
+ dlg.m_strPassword = m_strVssPassword;
+ userChoice = dlg.DoModal();
+ // process versioning system specific action
+ if(userChoice==IDOK)
+ {
+ CWaitCursor wait;
+ m_strVssProject = dlg.m_strProject;
+ theApp.WriteProfileString(_T("Settings"), _T("VssProject"), mf->m_strVssProject);
+ CString spath, sname;
+ SplitFilename(strSavePath, &spath, &sname, 0);
+ if (!spath.IsEmpty())
+ {
+ _chdrive(toupper(spath[0])-'A'+1);
+ _chdir(spath);
+ }
+ CString args;
+ args.Format(_T("checkout %s/%s"), m_strVssProject, sname);
+ HANDLE hVss = RunIt(m_strVssPath, args, TRUE, FALSE);
+ if (hVss!=INVALID_HANDLE_VALUE)
+ {
+ WaitForSingleObject(hVss, INFINITE);
+ DWORD code;
+ GetExitCodeProcess(hVss, &code);
+ CloseHandle(hVss);
+ if (code != 0)
{
- case IDCANCEL:
- return FALSE;
- case IDSAVEAS:
- CString title;
- VERIFY(title.LoadString(IDS_SAVE_AS_TITLE));
- if (SelectFile(s, strSavePath, title, NULL, FALSE))
- {
- strSavePath = s;
- needCheck=TRUE;
- }
- else
- return FALSE;
- break;
- }
+ AfxMessageBox(IDS_VSSERROR, MB_ICONSTOP);
+ return FALSE;
}
}
- } while (needCheck);
+ else
+ {
+ AfxMessageBox(IDS_VSS_RUN_ERROR, MB_ICONSTOP);
+ return FALSE;
+ }
+ }
+ }
+ break;
+ case 2: // CVisual SourceSafe 5.0+ (COM)
+ {
+ // prompt for user choice
+ CVssPrompt dlg;
+ dlg.m_strMessage.FormatMessage(IDS_SAVE_FMT, strSavePath);
+ dlg.m_strProject = m_strVssProject;
+ dlg.m_strUser = m_strVssUser; // BSP - Add VSS user name to dialog box
+ dlg.m_strPassword = m_strVssPassword;
+ userChoice = dlg.DoModal();
+ // process versioning system specific action
+ if(userChoice==IDOK)
+ {
+ CWaitCursor wait;
+ m_strVssProject = dlg.m_strProject;
+ m_strVssUser = dlg.m_strUser;
+ m_strVssPassword = dlg.m_strPassword;
+
+ theApp.WriteProfileString(_T("Settings"), _T("VssProject"), m_strVssProject);
+ theApp.WriteProfileString(_T("Settings"), _T("VssUser"), m_strVssUser);
+ theApp.WriteProfileString(_T("Settings"), _T("VssPassword"), m_strVssPassword);
+
+ IVSSDatabase vssdb;
+ IVSSItems m_vssis;
+ IVSSItem m_vssi;
+
+ COleException *eOleException = new COleException;
+
+ // BSP - Create the COM interface pointer to VSS
+ if (FAILED(vssdb.CreateDispatch("SourceSafe", eOleException)))
+ {
+ throw eOleException; // catch block deletes.
+ }
+ else
+ {
+ eOleException->Delete();
+ }
+
+ // BSP - Open the specific VSS data file using info from VSS dialog box
+ vssdb.Open(m_strVssPath, m_strVssUser, m_strVssPassword);
+
+ CString spath, sname;
+ SplitFilename(strSavePath, &spath, &sname, 0);
+
+ // BSP - Combine the project entered on the dialog box with the file name...
+ CString strItem = m_strVssProject + '/' + sname;
+
+ // BSP - ...to get the specific source safe item to be checked out
+ m_vssi = vssdb.GetVSSItem( strItem, 0 );
+
+ // BSP - Get the working directory where VSS will put the file...
+ CString strLocalSpec = m_vssi.GetLocalSpec();
+
+ // BSP - ...and compare it to the directory WinMerge is using.
+ if (strLocalSpec.CompareNoCase(strSavePath))
+ {
+ // BSP - if the directories are different, let the user confirm the CheckOut
+ int iRes = AfxMessageBox("The VSS Working Folder and the location of the current file do not match. Continue?", MB_YESNO);
+
+ if (iRes != IDYES)
+ return FALSE; // BSP - if not Yes, bail.
+ }
+
+ // BSP - Finally! Check out the file!
+ m_vssi.Checkout("", strSavePath, 0);
+ }
+ }
+ break;
+ case 3: // ClearCase
+ {
+ // prompt for user choice
+ CCCPrompt dlg;
+ userChoice = dlg.DoModal();
+ // process versioning system specific action
+ if(userChoice == IDOK)
+ {
+ CWaitCursor wait;
+ CString spath, sname;
+ SplitFilename(strSavePath, &spath, &sname, 0);
+ if (!spath.IsEmpty())
+ {
+ _chdrive(toupper(spath[0])-'A'+1);
+ _chdir(spath);
+ }
+ DWORD code;
+ CString args;
+ args.Format(_T("checkout -c \"%s\" %s"), dlg.m_comments, sname);
+ HANDLE hVss = RunIt(m_strVssPath, args, TRUE, FALSE);
+ if (hVss!=INVALID_HANDLE_VALUE)
+ {
+ WaitForSingleObject(hVss, INFINITE);
+ GetExitCodeProcess(hVss, &code);
+ CloseHandle(hVss);
+
+ if (code != 0)
+ {
+ AfxMessageBox(IDS_VSSERROR, MB_ICONSTOP);
+ return FALSE;
+ }
+ }
+ else
+ {
+ AfxMessageBox(IDS_VSS_RUN_ERROR, MB_ICONSTOP);
+ return FALSE;
+ }
+ }
+ }
+ break;
+ } //switch(m_nVerSys)
+
return TRUE;
}
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
+//
+// $Id$
#if !defined(AFX_MAINFRM_H__BBCD4F8C_34E4_11D1_BAA6_00A024706EDC__INCLUDED_)
#define AFX_MAINFRM_H__BBCD4F8C_34E4_11D1_BAA6_00A024706EDC__INCLUDED_
HMENU NewDefaultMenu();
BOOL CreateBackup(LPCTSTR pszPath);
BOOL CheckSavePath(CString& strSavePath);
+ BOOL SaveToVersionControl(CString& strSavePath);
CString SetStatus(LPCTSTR status);
// Overrides
//Microsoft Developer Studio generated resource script.
//
+// $Id$
+
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
IDS_FILESSAME "The selected files are identical."
IDS_FILEUNIQUE "The selected file didn't exist in both directories and therefore couldn't be compared."
IDS_FILEERROR "An error occurred while comparing the files."
- IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to save the file under a different name?"
+ IDS_SAVEREADONLY_FMT "%1 is marked read-only. Would you like to override the read-only file ? (No to save as new filename.)"
IDS_SAVE_FMT "Save changes to %1?"
IDS_FILEBINARY "Binary files cannot be visually compared."
IDS_SAVEVSS_FMT "%1 is marked read-only. Would you like to check it out from Versioning System, or save it under a different name?"
/////////////////////////////////////////////////////////////////////////////
// MergeDoc.cpp : implementation of the CMergeDoc class
//
+// $Id$
#include "stdafx.h"
#include "Merge.h"
return result;
}
-// Return value tells if caller can continue (no errors)
-// bSaveSuccess is TRUE if file saving succeeded
+/**
+* @brief Save file creating backups etc
+* Safe top-level file saving function. Checks validity of given path.
+* Creates backup file if wanted to. And if saving to given path fails,
+* allows user to select new location/name for file.
+*
+* @param szPath Path where to save including filename
+* @param bSaveSuccess Will contain information about save success
+* @param bLeft If TRUE we are saving left(side) file, else right file
+*
+* @return Tells if caller can continue (no errors happened)
+*
+* @note Return value does not tell if SAVING succeeded. Caller must
+* Check value of bSaveSuccess parameter after calling this function!
+*
+* @sa
+*
+*/
BOOL CMergeDoc::DoSave(LPCTSTR szPath, BOOL &bSaveSuccess, BOOL bLeft)
{
CString strSavePath(szPath);
int CMergeDoc::LineToDiff(UINT nLine)
{
for (UINT i = 0; i < m_nDiffs; i++)
- {
+ {
if (LineInDiff(nLine, i))
return i;
- }
+ }
return -1;
}
+2003-08-12 Kimmo
+ PATCH: [ 785288 ] Overwrite Read-Only file
+ WinMerge: MainFrm.h MainFrm.cpp Merge.rc MergeDoc.cpp
+ Languages: *.rc
+
2003-08-07 Kimmo
PATCH: [ 781013 ] 256 Color icon
editlib/res: Merge.ico