mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
2dbbfd6598
26 changed files with 406 additions and 385 deletions
|
@ -748,6 +748,17 @@ CRGBA CRGBA::stringToRGBA( const char *ptr )
|
|||
|
||||
return CRGBA( r,g,b,a );
|
||||
}
|
||||
|
||||
// we need at least 3 hexadecimal values to consider string is valid
|
||||
if (sscanf(ptr, "#%02x%02x%02x%02x", &r, &g, &b, &a) >= 3)
|
||||
{
|
||||
clamp(r, 0, 255);
|
||||
clamp(g, 0, 255);
|
||||
clamp(b, 0, 255);
|
||||
clamp(a, 0, 255);
|
||||
|
||||
return CRGBA(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
return NLMISC::CRGBA::White;
|
||||
|
|
|
@ -452,7 +452,7 @@ void SelectionTerritoire::OnSaveAs()
|
|||
CFileDialog sFile(false, _T("bank"), DefautPath+MainFileName, 0, szFilter, this);
|
||||
if (sFile.DoModal()==IDOK)
|
||||
{
|
||||
Save (sFile.GetPathName(), tileBank);
|
||||
Save (tStrToUtf8(sFile.GetPathName()).c_str(), tileBank);
|
||||
MainFileOk = 1;
|
||||
CButton *button = (CButton*)GetDlgItem(IDC_ADD_TERRITOIRE);
|
||||
button->EnableWindow(true);
|
||||
|
|
|
@ -240,7 +240,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
|
|||
uint Height;
|
||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||
{
|
||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
|
|||
char sTmp[512];
|
||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
||||
sprintf (sTmp, "%s\nPixel: %d (%s)", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
||||
return (int)(MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), "Can't add tile", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -288,7 +288,7 @@ int TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitma
|
|||
// Error: bitmap not in the absolute path..
|
||||
char msg[512];
|
||||
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
||||
return (int)(MessageBox (NULL, (std::string (msg)+"\nContinue ?").c_str(), "Load error", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, (std::string (msg)+"\nContinue ?").c_str(), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -305,7 +305,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
|
|||
uint Height;
|
||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||
{
|
||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -325,7 +325,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
|
|||
char sTmp[512];
|
||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
||||
sprintf (sTmp, "%s\nPixel: %d (%s)", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
||||
return (int)(MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), "Can't add tile", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -351,7 +351,7 @@ int TileList::setTile256 (int tile, const std::string& name, NL3D::CTile::TBitma
|
|||
// Error: bitmap not in the absolute path..
|
||||
char msg[512];
|
||||
sprintf (msg, "The bitmap %s is not in the absolute path %s.", name.c_str(), tileBank2.getAbsPath ().c_str());
|
||||
return (int)(MessageBox (NULL, (std::string (msg)+"\nContinue ?").c_str(), "Load error", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, (std::string (msg)+"\nContinue ?").c_str(), _T("Load error"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -371,7 +371,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
|
|||
uint Height;
|
||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||
{
|
||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
return (int)(MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -390,7 +390,7 @@ int TileList::setTileTransition (int tile, const std::string& name, NL3D::CTile:
|
|||
char sTmp[512];
|
||||
static const char* comp[]={"Red", "Green", "Blue", "Alpha", ""};
|
||||
sprintf (sTmp, "%s\nPixel: %d (%s)", CTileSet::getErrorMessage (error), pixel, comp[composante]);
|
||||
return MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), "Can't add tile", MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||
return MessageBox (NULL, (std::string(sTmp)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -483,7 +483,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
|
|||
uint Height;
|
||||
if (!loadPic(tileBank2.getAbsPath ()+troncated, tampon, Width, Height))
|
||||
{
|
||||
return MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), "Can't load bitmap.", MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||
return MessageBox (NULL, ((tileBank2.getAbsPath ()+troncated)+"\nContinue ?").c_str(), _T("Can't load bitmap."), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ int TileList::setTileTransitionAlpha (int tile, const std::string& name, int rot
|
|||
else
|
||||
sprintf (sMsg, "%s\nIncompatible filled tile", CTileSet::getErrorMessage (error));
|
||||
|
||||
return MessageBox (NULL, (std::string(sMsg)+"\nContinue ?").c_str(), "Can't add tile", MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||
return MessageBox (NULL, (std::string(sMsg)+"\nContinue ?").c_str(), _T("Can't add tile"), MB_YESNO|MB_ICONEXCLAMATION)==IDYES;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -674,7 +674,7 @@ bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
|
|||
if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index), &BmpInfo, Bits, Alpha, 0))
|
||||
{
|
||||
bRes=false;
|
||||
MessageBox (NULL, (tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index)).c_str(), "Can't load file", MB_OK|MB_ICONEXCLAMATION);
|
||||
MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::diffuse, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
else
|
||||
loaded=1;
|
||||
|
@ -684,7 +684,7 @@ bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
|
|||
if (!_LoadBitmap(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index), &nightBmpInfo, nightBits, Alpha, 0))
|
||||
{
|
||||
bRes=false;
|
||||
MessageBox (NULL, (tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index)).c_str(), "Can't load file", MB_OK|MB_ICONEXCLAMATION);
|
||||
MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::additive, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
else
|
||||
nightLoaded=1;
|
||||
|
@ -695,7 +695,7 @@ bool TileInfo::Load (int index, std::vector<NLMISC::CBGRA>* Alpha)
|
|||
tileBank2.getTile (index)->getRotAlpha ()))
|
||||
{
|
||||
bRes=false;
|
||||
MessageBox (NULL, (tileBank2.getAbsPath() + getRelativeFileName (CTile::alpha, index)).c_str(), "Can't load file", MB_OK|MB_ICONEXCLAMATION);
|
||||
MessageBox (NULL, utf8ToTStr(tileBank2.getAbsPath() + getRelativeFileName (CTile::alpha, index)), _T("Can't load file"), MB_OK|MB_ICONEXCLAMATION);
|
||||
}
|
||||
else
|
||||
alphaLoaded=1;
|
||||
|
|
|
@ -80,7 +80,7 @@ const CString & CConditionNode::getNodeAsString() const
|
|||
m_sNodeString = m_sConditionName;
|
||||
else // comparison
|
||||
{
|
||||
m_sNodeString.Format("%s %s %g",LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
m_sNodeString.Format(_T("%s %s %g"),LPCTSTR(m_sVariableName),LPCTSTR(m_sOperator), m_dComparand );
|
||||
}
|
||||
|
||||
return m_sNodeString;
|
||||
|
@ -260,8 +260,8 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC
|
|||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::COMPARISON;
|
||||
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = string( (LPCSTR)conditionNode->m_sVariableName );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = string( (LPCSTR)conditionNode->m_sOperator );
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.VariableName = tStrToUtf8(conditionNode->m_sVariableName);
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Operator = tStrToUtf8(conditionNode->m_sOperator);
|
||||
logicConditionNode->LogicBlock.ComparisonBlock.Comparand = (sint64)conditionNode->m_dComparand;
|
||||
}
|
||||
break;
|
||||
|
@ -270,7 +270,7 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC
|
|||
{
|
||||
logicConditionNode->LogicBlock.Type = CLogicConditionLogicBlock::SUB_CONDITION;
|
||||
|
||||
logicConditionNode->LogicBlock.SubCondition = string( (LPCSTR)conditionNode->m_sConditionName );
|
||||
logicConditionNode->LogicBlock.SubCondition = tStrToUtf8(conditionNode->m_sConditionName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ void cConditionNodeToCLogicConditionNode(CConditionNode * conditionNode, CLogicC
|
|||
void cConditionToCLogicCondition( CCondition& condition, CLogicCondition& logicCondition )
|
||||
{
|
||||
// condition name
|
||||
logicCondition.setName( string( (LPCSTR)condition.m_sName ) );
|
||||
logicCondition.setName(tStrToUtf8(condition.m_sName));
|
||||
|
||||
// nodes
|
||||
POSITION pos;
|
||||
|
|
|
@ -296,7 +296,7 @@ void CConditionPage::OnButtonAddCondition()
|
|||
|
||||
if (m_sConditionName.IsEmpty())
|
||||
{
|
||||
AfxMessageBox("Condition Name cannot be empty, please choose a name");
|
||||
AfxMessageBox(_T("Condition Name cannot be empty, please choose a name"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ void CConditionPage::OnButtonAddNode()
|
|||
// check that data are valid
|
||||
if ( checkNodeValidity() == FALSE)
|
||||
{
|
||||
AfxMessageBox("Invalid node datas - cannot add node");
|
||||
AfxMessageBox(_T("Invalid node datas - cannot add node"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ void CConditionPage::OnButtonCondApply()
|
|||
|
||||
if (m_sConditionName.IsEmpty())
|
||||
{
|
||||
AfxMessageBox("Condition Name cannot be empty, please choose a name");
|
||||
AfxMessageBox(_T("Condition Name cannot be empty, please choose a name"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ void CConditionPage::OnButtonCondApply()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No condition selected ! Choose a condition first" );
|
||||
AfxMessageBox(_T("No condition selected ! Choose a condition first"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void CConditionPage::OnButtonDeleteCondition()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No condition selected ! Choose a condition first" );
|
||||
AfxMessageBox(_T("No condition selected ! Choose a condition first"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ void CConditionPage::OnButtonNodeApply()
|
|||
// check that data are valid
|
||||
if ( checkNodeValidity() == FALSE)
|
||||
{
|
||||
AfxMessageBox("Invalid node datas - cancel node modification");
|
||||
AfxMessageBox(_T("Invalid node datas - cancel node modification"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ void CConditionPage::OnButtonNodeApply()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No condition node selected ! Choose a node first" );
|
||||
AfxMessageBox(_T("No condition node selected ! Choose a node first"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,6 +553,6 @@ void CConditionPage::OnButtonDeleteNode()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No condition node selected ! Choose a node first" );
|
||||
AfxMessageBox(_T("No condition node selected ! Choose a node first"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ void CConditionsView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
|
|||
|
||||
TPositionList heap;
|
||||
|
||||
HTREEITEM hItem = m_tree.InsertItem( "Conditions",0,0);
|
||||
HTREEITEM hItem = m_tree.InsertItem(_T("Conditions"), 0, 0);
|
||||
|
||||
// get the states map
|
||||
CCondition *pCondition;
|
||||
|
@ -645,7 +645,7 @@ void CConditionsView::OnMoveAsChild()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox("Error : root condition not found");
|
||||
AfxMessageBox(_T("Error : root condition not found"));
|
||||
delete pDragNode;
|
||||
}
|
||||
}
|
||||
|
@ -722,7 +722,7 @@ void CConditionsView::OnCopyAsChild()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox("Error : root condition not found");
|
||||
AfxMessageBox(_T("Error : root condition not found"));
|
||||
delete pNewNode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ CCounter::~CCounter()
|
|||
void cCounterToCLogicCounter( CCounter& counter, CLogicCounter& logicCounter )
|
||||
{
|
||||
// counter name
|
||||
logicCounter.setName( string((LPCSTR)counter.m_sName) );
|
||||
logicCounter.setName(tStrToUtf8(counter.m_sName));
|
||||
|
||||
// running mode
|
||||
if( counter.m_sMode == "Shuttle" )
|
||||
|
|
|
@ -194,7 +194,7 @@ void CCounterPage::OnButtonCounterRemove()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No counter selected ! Choose a counter first");
|
||||
AfxMessageBox(_T("No counter selected ! Choose a counter first"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ void CCounterPage::OnButtonCounterApply()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No counter selected ! Choose a counter first");
|
||||
AfxMessageBox(_T("No counter selected ! Choose a counter first"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void CEditorFormView::OnInitialUpdate()
|
|||
|
||||
CRect rectPlaceholder;
|
||||
GetWindowRect(rectPlaceholder);
|
||||
m_pPropertySheet = new CEditorPropertySheet("",this);
|
||||
m_pPropertySheet = new CEditorPropertySheet(_T(""),this);
|
||||
|
||||
if (!m_pPropertySheet->Create(this,WS_CHILD | WS_VISIBLE, 0) )
|
||||
{
|
||||
|
|
|
@ -114,7 +114,7 @@ void CMainFrame::OnClose()
|
|||
// load
|
||||
//
|
||||
//-----------------------------------------------
|
||||
void CMainFrame::load( const char * fileName )
|
||||
void CMainFrame::load( const TCHAR * fileName )
|
||||
{
|
||||
// child frame
|
||||
CChildFrame *pChild = (CChildFrame *) GetActiveFrame();
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
/**
|
||||
* load a logic state machine
|
||||
*/
|
||||
void load( const char * fileName );
|
||||
void load( const TCHAR *fileName );
|
||||
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
|
|
|
@ -70,7 +70,7 @@ bool operator==( const CEvent &ev1, const CEvent &ev2)
|
|||
void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent )
|
||||
{
|
||||
/// condition name
|
||||
logicEvent.ConditionName = string( (LPCSTR)event.m_sConditionName );
|
||||
logicEvent.ConditionName = tStrToUtf8(event.m_sConditionName);
|
||||
|
||||
/// event action
|
||||
logicEvent.EventAction.IsStateChange = !event.m_bActionIsMessage;
|
||||
|
@ -78,18 +78,18 @@ void cEventToCLogicEvent( CEvent& event, CLogicEvent& logicEvent )
|
|||
if( logicEvent.EventAction.IsStateChange )
|
||||
{
|
||||
/// state name for state change
|
||||
logicEvent.EventAction.StateChange = string( (LPCSTR)event.m_sStateChange );
|
||||
logicEvent.EventAction.StateChange = tStrToUtf8(event.m_sStateChange);
|
||||
}
|
||||
else
|
||||
{
|
||||
/// message destination
|
||||
logicEvent.EventAction.EventMessage.Destination = string( (LPCSTR)event.m_sMessageDestination );
|
||||
logicEvent.EventAction.EventMessage.Destination = tStrToUtf8(event.m_sMessageDestination);
|
||||
|
||||
/// message id
|
||||
logicEvent.EventAction.EventMessage.MessageId = "LOGIC"; //string( (LPCSTR)event.m_sMessageID ); //TEMP!!!
|
||||
|
||||
/// message arguments
|
||||
logicEvent.EventAction.EventMessage.Arguments = string( (LPCSTR)event.m_sArguments );
|
||||
logicEvent.EventAction.EventMessage.Arguments = tStrToUtf8(event.m_sArguments);
|
||||
}
|
||||
|
||||
} // cEventToCLogicEvent //
|
||||
|
@ -176,7 +176,7 @@ BOOL CState::removeEvent( CEvent *event)
|
|||
void cStateToCLogicState( CState& state, CLogicState& logicState )
|
||||
{
|
||||
/// state name
|
||||
logicState.setName( string( (LPCSTR)state.m_sName ) );
|
||||
logicState.setName(tStrToUtf8(state.m_sName));
|
||||
|
||||
POSITION pos;
|
||||
for( pos = state.m_evEvents.GetHeadPosition(); pos != NULL; )
|
||||
|
|
|
@ -251,7 +251,7 @@ void CStatePage::OnButtonAddState()
|
|||
|
||||
if (m_sStateName.IsEmpty())
|
||||
{
|
||||
AfxMessageBox("State name cannot be empty, please enter a valid name");
|
||||
AfxMessageBox(_T("State name cannot be empty, please enter a valid name"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ void CStatePage::OnButtonStateRemove()
|
|||
// get selected state
|
||||
if (m_pSelectedState != NULL)
|
||||
{
|
||||
if (AfxMessageBox("Your are about to permanently delete this state.\nDoing so will invalidate all references to this state.\nDo you want to continue anyway ?" ,MB_OKCANCEL|MB_DEFBUTTON2) == IDOK)
|
||||
if (AfxMessageBox(_T("Your are about to permanently delete this state.\nDoing so will invalidate all references to this state.\nDo you want to continue anyway ?") ,MB_OKCANCEL|MB_DEFBUTTON2) == IDOK)
|
||||
{
|
||||
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||||
CChildFrame *pChild = (CChildFrame *) pFrame->GetActiveFrame();
|
||||
|
@ -384,7 +384,7 @@ void CStatePage::OnButtonStateRemove()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No state selected ! Choose a state first" );
|
||||
AfxMessageBox(_T("No state selected ! Choose a state first"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -399,11 +399,11 @@ void CStatePage::OnButtonStateApply()
|
|||
{
|
||||
if (m_sStateName.IsEmpty())
|
||||
{
|
||||
AfxMessageBox("State name cannot be empty, please enter a valid name");
|
||||
AfxMessageBox(_T("State name cannot be empty, please enter a valid name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (AfxMessageBox("Your are about to change this state name.\nDoing so will change all occurence of the old name to the new one.\nDo you want to continue anyway ?" ,MB_OKCANCEL|MB_DEFBUTTON2) == IDOK)
|
||||
if (AfxMessageBox(_T("Your are about to change this state name.\nDoing so will change all occurence of the old name to the new one.\nDo you want to continue anyway ?") ,MB_OKCANCEL|MB_DEFBUTTON2) == IDOK)
|
||||
{
|
||||
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
|
||||
CChildFrame *pChild = (CChildFrame *) pFrame->GetActiveFrame();
|
||||
|
@ -418,14 +418,14 @@ void CStatePage::OnButtonStateApply()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No state selected ! Choose a state first" );
|
||||
AfxMessageBox(_T("No state selected ! Choose a state first"));
|
||||
}
|
||||
}
|
||||
|
||||
void CStatePage::OnButtonEventApply()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
AfxMessageBox( "Features not implemented" );
|
||||
AfxMessageBox(_T("Features not implemented"));
|
||||
}
|
||||
|
||||
void CStatePage::OnButtonEventRemove()
|
||||
|
@ -447,6 +447,6 @@ void CStatePage::OnButtonEventRemove()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No event selected ! Choose a event first" );
|
||||
AfxMessageBox(_T("No event selected ! Choose a event first"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ void CStatesView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
|
|||
m_tree.DeleteAllItems();
|
||||
m_mapItemToEvent.RemoveAll();
|
||||
|
||||
m_tree.InsertItem( "States");
|
||||
m_tree.InsertItem(_T("States"));
|
||||
|
||||
// get the states map
|
||||
CState *pState;
|
||||
|
|
|
@ -145,7 +145,7 @@ void CVariablePage::OnButtonVarDelete()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No variable selected ! Choose a variable first" );
|
||||
AfxMessageBox(_T("No variable selected ! Choose a variable first"));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ void CVariablePage::OnButtonVarApply()
|
|||
}
|
||||
else
|
||||
{
|
||||
AfxMessageBox( "No variable selected ! Choose a variable first" );
|
||||
AfxMessageBox(_T("No variable selected ! Choose a variable first"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ void CLogicEditor::go()
|
|||
// loadFile
|
||||
//
|
||||
//---------------------------------------------
|
||||
void CLogicEditor::loadFile( const char * fileName )
|
||||
void CLogicEditor::loadFile( const TCHAR * fileName )
|
||||
{
|
||||
AFX_MANAGE_STATE(AfxGetStaticModuleState());
|
||||
|
||||
|
@ -337,7 +337,7 @@ void CLogicEditor::loadFile( const char * fileName )
|
|||
// create a default file
|
||||
//
|
||||
//---------------------------------------------
|
||||
void CLogicEditor::createDefaultFile( const char * fileName )
|
||||
void CLogicEditor::createDefaultFile( const TCHAR * fileName )
|
||||
{
|
||||
// create an empty doc
|
||||
CLogic_editorDoc * pDoc = CLogic_editorDoc::getNewDoc();
|
||||
|
@ -402,7 +402,7 @@ ILogicEditor * ILogicEditor::getInterface( int version )
|
|||
// Check version number
|
||||
if( version != LOGIC_EDITOR_VERSION )
|
||||
{
|
||||
MessageBox( NULL, "Bad version of logic_editor.dll.", "Logic Editor", MB_ICONEXCLAMATION|MB_OK);
|
||||
MessageBox( NULL, _T("Bad version of logic_editor.dll."), _T("Logic Editor"), MB_ICONEXCLAMATION|MB_OK);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -88,12 +88,12 @@ public:
|
|||
/**
|
||||
* load file
|
||||
*/
|
||||
virtual void loadFile( const char * fileName );
|
||||
virtual void loadFile( const TCHAR * fileName );
|
||||
|
||||
/**
|
||||
* create a default file
|
||||
*/
|
||||
virtual void createDefaultFile( const char * filename = "logic.logic ");
|
||||
virtual void createDefaultFile( const TCHAR * filename = _T("logic.logic "));
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,10 +54,10 @@ public:
|
|||
virtual void*getMainFrame ()=0;
|
||||
|
||||
// load a logic file
|
||||
virtual void loadFile( const char * fileName ) = 0;
|
||||
virtual void loadFile( const TCHAR * fileName ) = 0;
|
||||
|
||||
// create a default file
|
||||
virtual void createDefaultFile( const char * filename = "logic.logic ") = 0;
|
||||
virtual void createDefaultFile( const TCHAR * filename = _T("logic.logic ")) = 0;
|
||||
|
||||
// Get instance
|
||||
static LOGIC_EDITOR_EXPORT ILogicEditor * getInterface( int version = LOGIC_EDITOR_VERSION );
|
||||
|
|
|
@ -96,10 +96,10 @@ BOOL CBranch_patcherDlg::OnInitDialog()
|
|||
// Extra initialization here
|
||||
|
||||
RECT cltRect;
|
||||
GetClientRect( &cltRect ),
|
||||
m_Display = new CRichEditCtrl();
|
||||
m_Display->Create( WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|ES_AUTOHSCROLL|ES_AUTOVSCROLL|ES_MULTILINE,
|
||||
CRect( 20, 180, cltRect.right-20, cltRect.bottom-20 ), this, 1 );
|
||||
GetClientRect(&cltRect),
|
||||
m_Display = new CRichEditCtrl();
|
||||
m_Display->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE,
|
||||
CRect(20, 180, cltRect.right - 20, cltRect.bottom - 20), this, 1);
|
||||
|
||||
// Initialize directories
|
||||
loadConfiguration();
|
||||
|
@ -109,8 +109,8 @@ BOOL CBranch_patcherDlg::OnInitDialog()
|
|||
EnteringTokens = false;
|
||||
m_SrcDirLabel = "Source Dir";
|
||||
m_TargetDirLabel = "Target Dir";
|
||||
UpdateData( false );
|
||||
((CButton*)GetDlgItem( IDC_DoPatch ))->EnableWindow( FALSE );
|
||||
UpdateData(false);
|
||||
((CButton*)GetDlgItem(IDC_DoPatch))->EnableWindow(FALSE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void CBranch_patcherDlg::OnPaint()
|
|||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
|
||||
SendMessage(WM_ICONERASEBKGND, (WPARAM)dc.GetSafeHdc(), 0);
|
||||
|
||||
// Center icon in client rectangle
|
||||
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||
|
@ -146,28 +146,28 @@ void CBranch_patcherDlg::OnPaint()
|
|||
|
||||
HCURSOR CBranch_patcherDlg::OnQueryDragIcon()
|
||||
{
|
||||
return (HCURSOR) m_hIcon;
|
||||
return (HCURSOR)m_hIcon;
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::setSrcDirectory( const CString& s )
|
||||
void CBranch_patcherDlg::setSrcDirectory(const CString& s)
|
||||
{
|
||||
m_SrcDir = s;
|
||||
UpdateData( false );
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CBranch_patcherDlg::setDestDirectory( const CString& s )
|
||||
void CBranch_patcherDlg::setDestDirectory(const CString& s)
|
||||
{
|
||||
m_DestDir = s;
|
||||
UpdateData( false );
|
||||
UpdateData(false);
|
||||
}
|
||||
|
||||
void CBranch_patcherDlg::OnButtonSetSrcDir()
|
||||
{
|
||||
DirDialog.m_strTitle = "Please choose the SOURCE directory";
|
||||
if ( DirDialog.DoBrowse() == TRUE )
|
||||
if (DirDialog.DoBrowse() == TRUE)
|
||||
{
|
||||
setSrcDirectory( DirDialog.m_strPath );
|
||||
setSrcDirectory(DirDialog.m_strPath);
|
||||
guessDestDirectory();
|
||||
}
|
||||
}
|
||||
|
@ -175,9 +175,9 @@ void CBranch_patcherDlg::OnButtonSetSrcDir()
|
|||
void CBranch_patcherDlg::OnButtonSetDestDir()
|
||||
{
|
||||
DirDialog.m_strTitle = "Please choose the TARGET directory";
|
||||
if ( DirDialog.DoBrowse() == TRUE )
|
||||
if (DirDialog.DoBrowse() == TRUE)
|
||||
{
|
||||
setDestDirectory( DirDialog.m_strPath );
|
||||
setDestDirectory(DirDialog.m_strPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,80 +198,86 @@ CDirDialog::~CDirDialog()
|
|||
|
||||
}
|
||||
|
||||
int CDirDialog::DoBrowse ()
|
||||
int CDirDialog::DoBrowse()
|
||||
{/////////////////////////////////////////
|
||||
|
||||
LPMALLOC pMalloc;
|
||||
if (SHGetMalloc (&pMalloc)!= NOERROR)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
LPMALLOC pMalloc;
|
||||
if (SHGetMalloc(&pMalloc) != NOERROR)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BROWSEINFO bInfo;
|
||||
LPITEMIDLIST pidl;
|
||||
ZeroMemory ( (PVOID) &bInfo,sizeof (BROWSEINFO));
|
||||
BROWSEINFO bInfo;
|
||||
LPITEMIDLIST pidl;
|
||||
ZeroMemory((PVOID)&bInfo, sizeof(BROWSEINFO));
|
||||
|
||||
if (!m_strInitDir.IsEmpty ())
|
||||
{
|
||||
OLECHAR olePath[MAX_PATH];
|
||||
ULONG chEaten;
|
||||
ULONG dwAttributes;
|
||||
HRESULT hr;
|
||||
LPSHELLFOLDER pDesktopFolder;
|
||||
// // Get a pointer to the Desktop's IShellFolder interface. //
|
||||
if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
|
||||
{
|
||||
if (!m_strInitDir.IsEmpty())
|
||||
{
|
||||
OLECHAR olePath[MAX_PATH];
|
||||
ULONG chEaten;
|
||||
ULONG dwAttributes;
|
||||
HRESULT hr;
|
||||
LPSHELLFOLDER pDesktopFolder;
|
||||
// // Get a pointer to the Desktop's IShellFolder interface. //
|
||||
if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
|
||||
{
|
||||
#ifndef _UNICODE
|
||||
//
|
||||
// IShellFolder::ParseDisplayName requires the file name be in Unicode.
|
||||
//
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, m_strInitDir.GetBuffer(MAX_PATH), -1, olePath, MAX_PATH);
|
||||
|
||||
//
|
||||
// IShellFolder::ParseDisplayName requires the file name be in Unicode.
|
||||
//
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, m_strInitDir.GetBuffer (MAX_PATH), -1,
|
||||
olePath, MAX_PATH);
|
||||
m_strInitDir.ReleaseBuffer(-1);
|
||||
#else
|
||||
wcscpy(olePath, (LPCTSTR)m_strInitDir);
|
||||
#endif
|
||||
//
|
||||
// Convert the path to an ITEMIDLIST.
|
||||
//
|
||||
hr = pDesktopFolder->ParseDisplayName(NULL,
|
||||
NULL,
|
||||
olePath,
|
||||
&chEaten,
|
||||
&pidl,
|
||||
&dwAttributes);
|
||||
|
||||
m_strInitDir.ReleaseBuffer (-1);
|
||||
//
|
||||
// Convert the path to an ITEMIDLIST.
|
||||
//
|
||||
hr = pDesktopFolder->ParseDisplayName(NULL,
|
||||
NULL,
|
||||
olePath,
|
||||
&chEaten,
|
||||
&pidl,
|
||||
&dwAttributes);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pMalloc ->Free (pidl);
|
||||
pMalloc ->Release ();
|
||||
return 0;
|
||||
}
|
||||
bInfo.pidlRoot = pidl;
|
||||
}
|
||||
}
|
||||
bInfo.hwndOwner = NULL;
|
||||
bInfo.pszDisplayName = m_strPath.GetBuffer (MAX_PATH);
|
||||
bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? "Open":m_strTitle;
|
||||
bInfo.ulFlags = BIF_RETURNFSANCESTORS|BIF_RETURNONLYFSDIRS;
|
||||
if (FAILED(hr))
|
||||
{
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bInfo.pidlRoot = pidl;
|
||||
|
||||
if ((pidl = ::SHBrowseForFolder (&bInfo)) == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
m_strPath.ReleaseBuffer ();
|
||||
m_iImageIndex = bInfo.iImage;
|
||||
}
|
||||
}
|
||||
|
||||
if (::SHGetPathFromIDList(pidl,m_strPath.GetBuffer (MAX_PATH)) == FALSE)
|
||||
{
|
||||
pMalloc ->Free (pidl);
|
||||
pMalloc ->Release ();
|
||||
return 0;
|
||||
}
|
||||
bInfo.hwndOwner = NULL;
|
||||
bInfo.pszDisplayName = m_strPath.GetBuffer(MAX_PATH);
|
||||
bInfo.lpszTitle = (m_strTitle.IsEmpty()) ? "Open" : m_strTitle;
|
||||
bInfo.ulFlags = BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS;
|
||||
|
||||
m_strPath.ReleaseBuffer ();
|
||||
if ((pidl = ::SHBrowseForFolder(&bInfo)) == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pMalloc ->Free (pidl);
|
||||
pMalloc ->Release ();
|
||||
return 1;
|
||||
m_strPath.ReleaseBuffer();
|
||||
m_iImageIndex = bInfo.iImage;
|
||||
|
||||
if (::SHGetPathFromIDList(pidl, m_strPath.GetBuffer(MAX_PATH)) == FALSE)
|
||||
{
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
return 0;
|
||||
}
|
||||
|
||||
m_strPath.ReleaseBuffer();
|
||||
|
||||
pMalloc->Free(pidl);
|
||||
pMalloc->Release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -280,87 +286,87 @@ int CDirDialog::DoBrowse ()
|
|||
*/
|
||||
BOOL SendTextToClipboard(CString source)
|
||||
{
|
||||
// Return value is TRUE if the text was sent
|
||||
// Return value is FALSE if something went wrong
|
||||
if(OpenClipboard(NULL))
|
||||
{
|
||||
HGLOBAL clipbuffer;
|
||||
char* buffer;
|
||||
// Return value is TRUE if the text was sent
|
||||
// Return value is FALSE if something went wrong
|
||||
if (OpenClipboard(NULL))
|
||||
{
|
||||
HGLOBAL clipbuffer;
|
||||
char* buffer;
|
||||
|
||||
EmptyClipboard(); // Empty whatever's already there
|
||||
EmptyClipboard(); // Empty whatever's already there
|
||||
|
||||
clipbuffer = GlobalAlloc(GMEM_DDESHARE, source.GetLength()+1);
|
||||
buffer = (char*)GlobalLock(clipbuffer);
|
||||
strcpy(buffer, LPCSTR(source));
|
||||
GlobalUnlock(clipbuffer);
|
||||
clipbuffer = GlobalAlloc(GMEM_DDESHARE, source.GetLength() + 1);
|
||||
buffer = (char*)GlobalLock(clipbuffer);
|
||||
strcpy(buffer, LPCSTR(source));
|
||||
GlobalUnlock(clipbuffer);
|
||||
|
||||
SetClipboardData(CF_TEXT, clipbuffer); // Send the data
|
||||
SetClipboardData(CF_TEXT, clipbuffer); // Send the data
|
||||
|
||||
CloseClipboard(); // VERY IMPORTANT
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
CloseClipboard(); // VERY IMPORTANT
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::displayMessage( const CString& msg, bool insertAtTop )
|
||||
void CBranch_patcherDlg::displayMessage(const CString& msg, bool insertAtTop)
|
||||
{
|
||||
if ( insertAtTop )
|
||||
m_Display->SetSel( 0, 0 );
|
||||
if (insertAtTop)
|
||||
m_Display->SetSel(0, 0);
|
||||
else
|
||||
m_Display->SetSel( 0, -1 );
|
||||
m_Display->ReplaceSel( msg );
|
||||
m_Display->SetSel(0, -1);
|
||||
m_Display->ReplaceSel(msg);
|
||||
SaveDiff = false;
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::OnButtonPatch()
|
||||
{
|
||||
UpdateData( true );
|
||||
UpdateData(true);
|
||||
|
||||
CString diffCmdLine;
|
||||
diffCmdLine.Format( "cvs.exe diff -c > %s 2> %s", TEMP_DIFF_FILE, DIFF_ERRORS ); // needs a valid cvs login before! and cvs.exe in the path
|
||||
diffCmdLine.Format(_T("cvs.exe diff -c > %s 2> %s"), TEMP_DIFF_FILE, DIFF_ERRORS); // needs a valid cvs login before! and cvs.exe in the path
|
||||
CString text;
|
||||
text.Format( "Get diff from directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s", m_SrcDir, diffCmdLine );
|
||||
text.Format(_T("Get diff from directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s"), m_SrcDir, diffCmdLine);
|
||||
int result;
|
||||
if ( (result = ::MessageBox( m_hWnd, text, "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION )) == IDYES )
|
||||
if ((result = ::MessageBox(m_hWnd, text, "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES)
|
||||
{
|
||||
if ( _chdir( m_SrcDir ) == 0 )
|
||||
if (_chdir(m_SrcDir) == 0)
|
||||
{
|
||||
system( diffCmdLine );
|
||||
displayFile( TEMP_DIFF_FILE );
|
||||
system(diffCmdLine);
|
||||
displayFile(TEMP_DIFF_FILE);
|
||||
SaveDiff = true;
|
||||
colorizeDiff();
|
||||
m_Display->LineScroll( 0 );
|
||||
((CButton*)GetDlgItem( IDC_DoPatch ))->EnableWindow( TRUE );
|
||||
m_Display->LineScroll(0);
|
||||
((CButton*)GetDlgItem(IDC_DoPatch))->EnableWindow(TRUE);
|
||||
|
||||
if ( (m_Display->GetLineCount() == 0) ||
|
||||
(m_Display->GetLineCount() == 1 && m_Display->LineLength(0)<2) )
|
||||
if ((m_Display->GetLineCount() == 0) ||
|
||||
(m_Display->GetLineCount() == 1 && m_Display->LineLength(0) < 2))
|
||||
{
|
||||
displayFile( DIFF_ERRORS );
|
||||
displayMessage( "Diff is empty.\r\nIf this is not the expected result:\r\n- check if the source directory is part of a CVS tree\r\n- check if cvs.exe is in your PATH\r\n- check if you are logged to the cvs server with 'cvs login' (set your home cvs directory in the HOME environment variable if needed)\r\n- check if C:\\ has enough free space and access rights to write a file.\n\nHere is the log:\n\n", true );
|
||||
displayFile(DIFF_ERRORS);
|
||||
displayMessage("Diff is empty.\r\nIf this is not the expected result:\r\n- check if the source directory is part of a CVS tree\r\n- check if cvs.exe is in your PATH\r\n- check if you are logged to the cvs server with 'cvs login' (set your home cvs directory in the HOME environment variable if needed)\r\n- check if C:\\ has enough free space and access rights to write a file.\n\nHere is the log:\n\n", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Filename = TEMP_DIFF_FILE + ":";
|
||||
UpdateData( false );
|
||||
UpdateData(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displayMessage( "Source directory not found" );
|
||||
displayMessage("Source directory not found");
|
||||
}
|
||||
}
|
||||
else if ( result == IDNO )
|
||||
else if (result == IDNO)
|
||||
{
|
||||
SendTextToClipboard( diffCmdLine );
|
||||
SendTextToClipboard(diffCmdLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static unsigned long CALLBACK MyStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||
{
|
||||
CFile* pFile = (CFile*) dwCookie;
|
||||
CFile* pFile = (CFile*)dwCookie;
|
||||
*pcb = pFile->Read(pbBuff, cb);
|
||||
return 0;
|
||||
}
|
||||
|
@ -368,69 +374,69 @@ static unsigned long CALLBACK MyStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBu
|
|||
|
||||
static unsigned long CALLBACK MyStreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
|
||||
{
|
||||
CFile* pFile = (CFile*) dwCookie;
|
||||
CFile* pFile = (CFile*)dwCookie;
|
||||
pFile->Write(pbBuff, cb);
|
||||
*pcb = cb;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::displayFile( const CString& filename )
|
||||
void CBranch_patcherDlg::displayFile(const CString& filename)
|
||||
{
|
||||
CFile cFile( filename, CFile::modeRead );
|
||||
CFile cFile(filename, CFile::modeRead);
|
||||
EDITSTREAM es;
|
||||
es.dwCookie = (DWORD_PTR) &cFile;
|
||||
es.dwCookie = (DWORD_PTR)&cFile;
|
||||
es.pfnCallback = MyStreamInCallback;
|
||||
m_Display->StreamIn( SF_TEXT, es );
|
||||
m_Display->StreamIn(SF_TEXT, es);
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::saveFile( const CString& filename )
|
||||
void CBranch_patcherDlg::saveFile(const CString& filename)
|
||||
{
|
||||
CFile cFile( filename, CFile::modeCreate | CFile::modeWrite );
|
||||
CFile cFile(filename, CFile::modeCreate | CFile::modeWrite);
|
||||
EDITSTREAM es;
|
||||
es.dwCookie = (DWORD_PTR) &cFile;
|
||||
es.dwCookie = (DWORD_PTR)&cFile;
|
||||
es.pfnCallback = MyStreamOutCallback;
|
||||
m_Display->StreamOut( SF_TEXT, es );
|
||||
m_Display->StreamOut(SF_TEXT, es);
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::colorizeDiff()
|
||||
{
|
||||
CHARFORMAT blue;
|
||||
ZeroMemory( &blue, sizeof(blue) );
|
||||
ZeroMemory(&blue, sizeof(blue));
|
||||
blue.cbSize = sizeof(blue);
|
||||
blue.dwMask = CFM_COLOR;
|
||||
blue.crTextColor = RGB(0,0,0xFF);
|
||||
blue.crTextColor = RGB(0, 0, 0xFF);
|
||||
CHARFORMAT red;
|
||||
ZeroMemory( &red, sizeof(red) );
|
||||
ZeroMemory(&red, sizeof(red));
|
||||
red.cbSize = sizeof(red);
|
||||
red.dwMask = CFM_COLOR;
|
||||
red.crTextColor = RGB(0xFF,0,0);
|
||||
red.crTextColor = RGB(0xFF, 0, 0);
|
||||
CHARFORMAT green;
|
||||
ZeroMemory( &green, sizeof(green) );
|
||||
ZeroMemory(&green, sizeof(green));
|
||||
green.cbSize = sizeof(green);
|
||||
green.dwMask = CFM_COLOR;
|
||||
green.crTextColor = RGB(0,0x7F,0);
|
||||
for ( int i=0; i!=m_Display->GetLineCount(); ++i )
|
||||
green.crTextColor = RGB(0, 0x7F, 0);
|
||||
for (int i = 0; i != m_Display->GetLineCount(); ++i)
|
||||
{
|
||||
int c = m_Display->LineIndex( i );
|
||||
int l = m_Display->LineLength( c );
|
||||
m_Display->SetSel( c, c+l );
|
||||
int c = m_Display->LineIndex(i);
|
||||
int l = m_Display->LineLength(c);
|
||||
m_Display->SetSel(c, c + l);
|
||||
CString s = m_Display->GetSelText();
|
||||
if ( ! s.IsEmpty() )
|
||||
if (!s.IsEmpty())
|
||||
{
|
||||
if ( s.Left(2) == "+ " )
|
||||
if (s.Left(2) == "+ ")
|
||||
{
|
||||
m_Display->SetSelectionCharFormat( blue );
|
||||
m_Display->SetSelectionCharFormat(blue);
|
||||
}
|
||||
else if ( s.Left(2) == "- " )
|
||||
else if (s.Left(2) == "- ")
|
||||
{
|
||||
m_Display->SetSelectionCharFormat( red );
|
||||
m_Display->SetSelectionCharFormat(red);
|
||||
}
|
||||
else if ( s.Left(2) == "! " )
|
||||
else if (s.Left(2) == "! ")
|
||||
{
|
||||
m_Display->SetSelectionCharFormat( green );
|
||||
m_Display->SetSelectionCharFormat(green);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -439,55 +445,55 @@ void CBranch_patcherDlg::colorizeDiff()
|
|||
|
||||
void CBranch_patcherDlg::OnDoPatch()
|
||||
{
|
||||
UpdateData( true );
|
||||
UpdateData(true);
|
||||
|
||||
if ( SaveDiff )
|
||||
if (SaveDiff)
|
||||
{
|
||||
// Save the diff from the richedit
|
||||
saveFile( TEMP_DIFF_FILE );
|
||||
saveFile(TEMP_DIFF_FILE);
|
||||
}
|
||||
|
||||
// Apply the patch
|
||||
CString patchCmdLine, concatOutput, delPatchErrors;
|
||||
patchCmdLine.Format( "%spatch.exe -c -p%u --verbose < %s > %s 2> %s", PatchExeDir, CvsDiffDirLevel, TEMP_DIFF_FILE, PATCH_RESULT, PATCH_ERRORS ); // needs patch.exe in the path
|
||||
concatOutput.Format( "copy %s+%s %s", PATCH_RESULT, PATCH_ERRORS, PATCH_RESULT );
|
||||
delPatchErrors.Format( "del %s", PATCH_ERRORS );
|
||||
patchCmdLine.Format(_T("%spatch.exe -c -p%u --verbose < %s > %s 2> %s"), PatchExeDir, CvsDiffDirLevel, TEMP_DIFF_FILE, PATCH_RESULT, PATCH_ERRORS); // needs patch.exe in the path
|
||||
concatOutput.Format(_T("copy %s+%s %s"), PATCH_RESULT, PATCH_ERRORS, PATCH_RESULT);
|
||||
delPatchErrors.Format(_T("del %s"), PATCH_ERRORS);
|
||||
|
||||
CString text;
|
||||
text.Format( "Patch diff to directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s", m_DestDir, patchCmdLine );
|
||||
text.Format(_T("Patch diff to directory %s?\n\nCommand (choose No to copy it into the clipboard):\n%s"), (LPCTSTR)m_DestDir, (LPCTSTR)patchCmdLine);
|
||||
int result;
|
||||
if ( (result = ::MessageBox( m_hWnd, text, "Confirmation", MB_YESNOCANCEL | MB_ICONQUESTION )) == IDYES )
|
||||
if ((result = ::MessageBox(m_hWnd, text, _T("Confirmation"), MB_YESNOCANCEL | MB_ICONQUESTION)) == IDYES)
|
||||
{
|
||||
if ( _chdir( m_DestDir ) == 0 )
|
||||
if (_chdir(m_DestDir) == 0)
|
||||
{
|
||||
system( patchCmdLine );
|
||||
system( concatOutput );
|
||||
system( delPatchErrors );
|
||||
displayFile( PATCH_RESULT );
|
||||
system(patchCmdLine);
|
||||
system(concatOutput);
|
||||
system(delPatchErrors);
|
||||
displayFile(PATCH_RESULT);
|
||||
SaveDiff = false;
|
||||
m_Display->LineScroll( 0 );
|
||||
m_Display->LineScroll(0);
|
||||
|
||||
if ( (m_Display->GetLineCount() == 0) ||
|
||||
(m_Display->GetLineCount() == 1 && m_Display->LineLength(0)<2) )
|
||||
if ((m_Display->GetLineCount() == 0) ||
|
||||
(m_Display->GetLineCount() == 1 && m_Display->LineLength(0) < 2))
|
||||
{
|
||||
CString s;
|
||||
s.Format( "Nothing was patched.\r\nIf this is not the expected result:\r\n- check if the good patch.exe is in %s\r\n- check if %s exists (generated by previous diff)\r\n- check if C:\\ has enough free space and access rights to write a file.", TEMP_DIFF_FILE );
|
||||
displayMessage( s );
|
||||
s.Format(_T("Nothing was patched.\r\nIf this is not the expected result:\r\n- check if the good patch.exe is in %s\r\n- check if %s exists (generated by previous diff)\r\n- check if C:\\ has enough free space and access rights to write a file."), TEMP_DIFF_FILE);
|
||||
displayMessage(s);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Filename = PATCH_RESULT + ":";
|
||||
UpdateData( false );
|
||||
UpdateData(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displayMessage( "Target directory not found" );
|
||||
displayMessage("Target directory not found");
|
||||
}
|
||||
}
|
||||
else if ( result == IDNO )
|
||||
else if (result == IDNO)
|
||||
{
|
||||
SendTextToClipboard( patchCmdLine );
|
||||
SendTextToClipboard(patchCmdLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -496,12 +502,12 @@ void CBranch_patcherDlg::OnSize(UINT nType, int cx, int cy)
|
|||
{
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
|
||||
if ( m_Display )
|
||||
if (m_Display)
|
||||
{
|
||||
RECT cltRect;
|
||||
GetClientRect( &cltRect );
|
||||
GetClientRect(&cltRect);
|
||||
CRect dispRect;
|
||||
m_Display->MoveWindow( 20, 180, cltRect.right-40, cltRect.bottom-200, true );
|
||||
m_Display->MoveWindow(20, 180, cltRect.right - 40, cltRect.bottom - 200, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -517,9 +523,9 @@ void CBranch_patcherDlg::processCommandLine()
|
|||
{
|
||||
CString cmdLine = theApp.m_lpCmdLine;
|
||||
|
||||
if ( ! cmdLine.IsEmpty() )
|
||||
if (!cmdLine.IsEmpty())
|
||||
{
|
||||
setSrcDirectory( cmdLine );
|
||||
setSrcDirectory(cmdLine);
|
||||
guessDestDirectory();
|
||||
}
|
||||
}
|
||||
|
@ -527,18 +533,18 @@ void CBranch_patcherDlg::processCommandLine()
|
|||
|
||||
void CBranch_patcherDlg::guessDestDirectory()
|
||||
{
|
||||
if ( hasTokens() )
|
||||
if (hasTokens())
|
||||
{
|
||||
CString dir = m_SrcDir;
|
||||
if ( dir.Find( "\\"+Token1+"\\", 0 ) != -1 )
|
||||
if (dir.Find("\\" + Token1 + "\\", 0) != -1)
|
||||
{
|
||||
dir.Replace( "\\"+Token1+"\\", "\\"+Token2+"\\" );
|
||||
setDestDirectory( dir );
|
||||
dir.Replace("\\" + Token1 + "\\", "\\" + Token2 + "\\");
|
||||
setDestDirectory(dir);
|
||||
}
|
||||
else if ( dir.Find( "\\"+Token2+"\\", 0 ) != -1 )
|
||||
else if (dir.Find("\\" + Token2 + "\\", 0) != -1)
|
||||
{
|
||||
dir.Replace( "\\"+Token2+"\\", "\\"+Token1+"\\" );
|
||||
setDestDirectory( dir );
|
||||
dir.Replace("\\" + Token2 + "\\", "\\" + Token1 + "\\");
|
||||
setDestDirectory(dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -548,51 +554,51 @@ void CBranch_patcherDlg::extractDirTokens()
|
|||
{
|
||||
int beginOfToken1, beginOfToken2, endOfToken1, endOfToken2;
|
||||
CString text;
|
||||
UpdateData( true );
|
||||
UpdateData(true);
|
||||
|
||||
// Search backward from the end until a different substring is found
|
||||
int c1 = m_SrcDir.GetLength()-1;
|
||||
int c2 = m_DestDir.GetLength()-1;
|
||||
while ( (c1 >= 0) && (c2 >= 0) && (m_SrcDir[c1] == m_DestDir[c2]) )
|
||||
int c1 = m_SrcDir.GetLength() - 1;
|
||||
int c2 = m_DestDir.GetLength() - 1;
|
||||
while ((c1 >= 0) && (c2 >= 0) && (m_SrcDir[c1] == m_DestDir[c2]))
|
||||
{
|
||||
--c1;
|
||||
--c2;
|
||||
}
|
||||
|
||||
// Test if both strings are identical
|
||||
if ( (c1 < 0) || (c2 < 0) )
|
||||
if ((c1 < 0) || (c2 < 0))
|
||||
{
|
||||
Token1 = m_SrcDir;
|
||||
Token2 = m_DestDir;
|
||||
return;
|
||||
}
|
||||
endOfToken1 = c1+1;
|
||||
endOfToken2 = c2+1;
|
||||
endOfToken1 = c1 + 1;
|
||||
endOfToken2 = c2 + 1;
|
||||
|
||||
// Search forward from the beginning until a different substring is found
|
||||
c1 = 0;
|
||||
c2 = 0;
|
||||
while ( (c1 < m_SrcDir.GetLength()) && (c2 < m_DestDir.GetLength()) && (m_SrcDir[c1] == m_DestDir[c2]) )
|
||||
while ((c1 < m_SrcDir.GetLength()) && (c2 < m_DestDir.GetLength()) && (m_SrcDir[c1] == m_DestDir[c2]))
|
||||
{
|
||||
++c1;
|
||||
++c2;
|
||||
}
|
||||
if ( (c1 == m_SrcDir.GetLength()) || (c2 == m_DestDir.GetLength()) )
|
||||
if ((c1 == m_SrcDir.GetLength()) || (c2 == m_DestDir.GetLength()))
|
||||
{
|
||||
return; // both strings are identical (should not occur again)
|
||||
}
|
||||
|
||||
// If one of the token is empty, expand both downto the closest backslash
|
||||
if ( (c1 == endOfToken1) || (c2 == endOfToken2) )
|
||||
if ((c1 == endOfToken1) || (c2 == endOfToken2))
|
||||
{
|
||||
--c1;
|
||||
while ( (c1 >= 0) && (m_SrcDir[c1] != '\\') )
|
||||
while ((c1 >= 0) && (m_SrcDir[c1] != '\\'))
|
||||
{
|
||||
--c1;
|
||||
}
|
||||
++c1;
|
||||
--c2;
|
||||
while ( (c2 >= 0) && (m_DestDir[c2] != '\\') )
|
||||
while ((c2 >= 0) && (m_DestDir[c2] != '\\'))
|
||||
{
|
||||
--c2;
|
||||
}
|
||||
|
@ -601,64 +607,64 @@ void CBranch_patcherDlg::extractDirTokens()
|
|||
beginOfToken1 = c1;
|
||||
beginOfToken2 = c2;
|
||||
|
||||
Token1 = m_SrcDir.Mid( beginOfToken1, endOfToken1-beginOfToken1 );
|
||||
Token2 = m_DestDir.Mid( beginOfToken2, endOfToken2-beginOfToken2 );
|
||||
Token1 = m_SrcDir.Mid(beginOfToken1, endOfToken1 - beginOfToken1);
|
||||
Token2 = m_DestDir.Mid(beginOfToken2, endOfToken2 - beginOfToken2);
|
||||
|
||||
//endExtract:
|
||||
/*if ( hasTokens() )
|
||||
{
|
||||
text.Format( "The two branch tokens '%s' and '%s' are now stored", Token1, Token2 );
|
||||
::MessageBox( m_hWnd, text, "Tokens found", MB_OK | MB_ICONINFORMATION );
|
||||
return;
|
||||
}*/
|
||||
//notfound:
|
||||
//::MessageBox( m_hWnd, "Tokens not found in the directories", "Extracting tokens", MB_OK | MB_ICONEXCLAMATION );
|
||||
//endExtract:
|
||||
/*if ( hasTokens() )
|
||||
{
|
||||
text.Format( "The two branch tokens '%s' and '%s' are now stored", Token1, Token2 );
|
||||
::MessageBox( m_hWnd, text, "Tokens found", MB_OK | MB_ICONINFORMATION );
|
||||
return;
|
||||
}*/
|
||||
//notfound:
|
||||
//::MessageBox( m_hWnd, "Tokens not found in the directories", "Extracting tokens", MB_OK | MB_ICONEXCLAMATION );
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::loadConfiguration()
|
||||
{
|
||||
// Read the dest directory from the registry
|
||||
free( (void*)theApp.m_pszRegistryKey );
|
||||
theApp.m_pszRegistryKey = _tcsdup( _T("Nevrax") );
|
||||
free((void*)theApp.m_pszRegistryKey);
|
||||
theApp.m_pszRegistryKey = _tcsdup(_T("Nevrax"));
|
||||
|
||||
CString savedSrcDir, savedTargetDir, token1, token2;
|
||||
if ( m_SrcDir.IsEmpty() )
|
||||
if (m_SrcDir.IsEmpty())
|
||||
{
|
||||
savedSrcDir = theApp.GetProfileString( _T(""), _T("SourceDir") );
|
||||
if ( ! savedSrcDir.IsEmpty() )
|
||||
savedSrcDir = theApp.GetProfileString(_T(""), _T("SourceDir"));
|
||||
if (!savedSrcDir.IsEmpty())
|
||||
{
|
||||
setSrcDirectory( savedSrcDir );
|
||||
setSrcDirectory(savedSrcDir);
|
||||
}
|
||||
}
|
||||
savedTargetDir = theApp.GetProfileString( _T(""), _T("TargetDir") );
|
||||
if ( ! savedTargetDir.IsEmpty() )
|
||||
savedTargetDir = theApp.GetProfileString(_T(""), _T("TargetDir"));
|
||||
if (!savedTargetDir.IsEmpty())
|
||||
{
|
||||
setDestDirectory( savedTargetDir );
|
||||
setDestDirectory(savedTargetDir);
|
||||
}
|
||||
Token1 = theApp.GetProfileString( _T(""), _T("Token1") );
|
||||
Token2 = theApp.GetProfileString( _T(""), _T("Token2") );
|
||||
PatchExeDir = theApp.GetProfileString( _T(""), _T("PatchExeDir") );
|
||||
CvsDiffDirLevel = theApp.GetProfileInt( _T(""), _T("CvsDiffDirLevel"), 1 ); // 0 for old version of CVS, 1 for new version of CVS
|
||||
Token1 = theApp.GetProfileString(_T(""), _T("Token1"));
|
||||
Token2 = theApp.GetProfileString(_T(""), _T("Token2"));
|
||||
PatchExeDir = theApp.GetProfileString(_T(""), _T("PatchExeDir"));
|
||||
CvsDiffDirLevel = theApp.GetProfileInt(_T(""), _T("CvsDiffDirLevel"), 1); // 0 for old version of CVS, 1 for new version of CVS
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::saveConfiguration()
|
||||
{
|
||||
UpdateData( true );
|
||||
if ( ! EnteringTokens )
|
||||
UpdateData(true);
|
||||
if (!EnteringTokens)
|
||||
{
|
||||
theApp.WriteProfileString( _T(""), _T("SourceDir"), m_SrcDir );
|
||||
theApp.WriteProfileString( _T(""), _T("TargetDir"), m_DestDir );
|
||||
theApp.WriteProfileString(_T(""), _T("SourceDir"), m_SrcDir);
|
||||
theApp.WriteProfileString(_T(""), _T("TargetDir"), m_DestDir);
|
||||
}
|
||||
theApp.WriteProfileString( _T(""), _T("Token1"), Token1 );
|
||||
theApp.WriteProfileString( _T(""), _T("Token2"), Token2 );
|
||||
theApp.WriteProfileString(_T(""), _T("Token1"), Token1);
|
||||
theApp.WriteProfileString(_T(""), _T("Token2"), Token2);
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::OnButtonExtractTokens()
|
||||
{
|
||||
if ( ! EnteringTokens )
|
||||
if (!EnteringTokens)
|
||||
{
|
||||
EnteringTokens = true;
|
||||
extractDirTokens();
|
||||
|
@ -669,18 +675,18 @@ void CBranch_patcherDlg::OnButtonExtractTokens()
|
|||
m_SrcDirLabel = "Enter Token 1";
|
||||
m_TargetDirLabel = "Enter Token 2";
|
||||
m_Filename = "The tokens above were extracted from the directories.";
|
||||
((CButton*)GetDlgItem( IDC_ButtonExtractTokens ))->SetWindowText( _T("Store Tokens") );
|
||||
GetDlgItem( IDC_TopText )->ShowWindow( SW_HIDE );
|
||||
GetDlgItem( IDC_ButtonClearTokens )->EnableWindow( FALSE );
|
||||
GetDlgItem( IDC_ButtonPatch )->ShowWindow( SW_HIDE );
|
||||
GetDlgItem( IDC_ButtonPatch )->EnableWindow( FALSE );
|
||||
GetDlgItem( IDC_DoPatch )->ShowWindow( SW_HIDE );
|
||||
GetDlgItem( IDC_Group )->ShowWindow( SW_HIDE );
|
||||
UpdateData( false );
|
||||
((CButton*)GetDlgItem(IDC_ButtonExtractTokens))->SetWindowText(_T("Store Tokens"));
|
||||
GetDlgItem(IDC_TopText)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_ButtonClearTokens)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_ButtonPatch)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_ButtonPatch)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_DoPatch)->ShowWindow(SW_HIDE);
|
||||
GetDlgItem(IDC_Group)->ShowWindow(SW_HIDE);
|
||||
UpdateData(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateData( true );
|
||||
UpdateData(true);
|
||||
EnteringTokens = false;
|
||||
Token1 = m_SrcDir;
|
||||
Token2 = m_DestDir;
|
||||
|
@ -689,13 +695,13 @@ void CBranch_patcherDlg::OnButtonExtractTokens()
|
|||
m_SrcDir = SrcDirBackup;
|
||||
m_DestDir = TargetDirBackup;
|
||||
m_Filename.Empty();
|
||||
((CButton*)GetDlgItem( IDC_ButtonExtractTokens ))->SetWindowText( _T("Enter Tokens") );
|
||||
GetDlgItem( IDC_TopText )->ShowWindow( SW_SHOW );
|
||||
GetDlgItem( IDC_ButtonClearTokens )->EnableWindow( TRUE );
|
||||
GetDlgItem( IDC_ButtonPatch )->ShowWindow( SW_SHOW );
|
||||
GetDlgItem( IDC_ButtonPatch )->EnableWindow( TRUE );
|
||||
GetDlgItem( IDC_DoPatch )->ShowWindow( SW_SHOW );
|
||||
GetDlgItem( IDC_Group )->ShowWindow( SW_SHOW );
|
||||
((CButton*)GetDlgItem(IDC_ButtonExtractTokens))->SetWindowText(_T("Enter Tokens"));
|
||||
GetDlgItem(IDC_TopText)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_ButtonClearTokens)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_ButtonPatch)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_ButtonPatch)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_DoPatch)->ShowWindow(SW_SHOW);
|
||||
GetDlgItem(IDC_Group)->ShowWindow(SW_SHOW);
|
||||
displayTokens();
|
||||
}
|
||||
}
|
||||
|
@ -711,14 +717,14 @@ void CBranch_patcherDlg::OnButtonClearTokens()
|
|||
|
||||
bool CBranch_patcherDlg::hasTokens() const
|
||||
{
|
||||
return ! (Token1.IsEmpty() || Token2.IsEmpty());
|
||||
return !(Token1.IsEmpty() || Token2.IsEmpty());
|
||||
}
|
||||
|
||||
|
||||
void CBranch_patcherDlg::displayTokens()
|
||||
{
|
||||
((CButton*)GetDlgItem( IDC_ButtonClearTokens ))->EnableWindow( hasTokens()?TRUE:FALSE );
|
||||
if ( hasTokens() )
|
||||
((CButton*)GetDlgItem(IDC_ButtonClearTokens))->EnableWindow(hasTokens() ? TRUE : FALSE);
|
||||
if (hasTokens())
|
||||
{
|
||||
m_Tokens = "Tokens: '" + Token1 + "' and '" + Token2 + "'";
|
||||
}
|
||||
|
@ -726,5 +732,5 @@ void CBranch_patcherDlg::displayTokens()
|
|||
{
|
||||
m_Tokens = "No token";
|
||||
}
|
||||
UpdateData( false );
|
||||
UpdateData(false);
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ void CData_mirrorDlg::updateList ()
|
|||
{
|
||||
// Add the items
|
||||
const CEntryFile &entry = *ite;
|
||||
uint nItem = List.InsertItem (0, entry.Strings[CEntryFile::Path].c_str (), entry.Image);
|
||||
uint nItem = List.InsertItem (0, utf8ToTStr(entry.Strings[CEntryFile::Path]), entry.Image);
|
||||
List.SetItemData (nItem, DWORD(new std::list<CEntryFile>::iterator (ite)));
|
||||
|
||||
// Sub string
|
||||
|
@ -289,25 +289,25 @@ void CData_mirrorDlg::updateList ()
|
|||
// Add the sizes
|
||||
if (ModifiedFilter != Removed)
|
||||
{
|
||||
List.SetItemText (nItem, subString++, entry.Strings[CEntryFile::NewSize].c_str ());
|
||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewSize]));
|
||||
}
|
||||
if (ModifiedFilter != Added)
|
||||
{
|
||||
List.SetItemText (nItem, subString++, entry.Strings[CEntryFile::OldSize].c_str ());
|
||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldSize]));
|
||||
}
|
||||
|
||||
// Add the dates
|
||||
if (ModifiedFilter != Removed)
|
||||
{
|
||||
List.SetItemText (nItem, subString++, entry.Strings[CEntryFile::NewDate].c_str ());
|
||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::NewDate]));
|
||||
}
|
||||
if (ModifiedFilter != Added)
|
||||
{
|
||||
List.SetItemText (nItem, subString++, entry.Strings[CEntryFile::OldDate].c_str ());
|
||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::OldDate]));
|
||||
}
|
||||
|
||||
// Add the type
|
||||
List.SetItemText (nItem, subString++, entry.Strings[CEntryFile::Type].c_str ());
|
||||
List.SetItemText (nItem, subString++, utf8ToTStr(entry.Strings[CEntryFile::Type]));
|
||||
|
||||
// Next item
|
||||
ite++;
|
||||
|
@ -382,7 +382,7 @@ void CData_mirrorDlg::OnIgnore()
|
|||
CString itemText = List.GetItemText (i, 0);
|
||||
|
||||
// Add to ignore list
|
||||
IgnoreFiles.insert ((const char*)itemText);
|
||||
IgnoreFiles.insert (tStrToUtf8(itemText));
|
||||
|
||||
// Remove from the file list
|
||||
std::list<CEntryFile>::iterator *ite = (std::list<CEntryFile>::iterator *)List.GetItemData (i);
|
||||
|
@ -408,9 +408,9 @@ void createDirectory (const string &dir)
|
|||
NLMISC::CFile::createDirectory (dir);
|
||||
}
|
||||
|
||||
bool setFileTime (const char *filename, const FILETIME &result)
|
||||
bool setFileTime(const std::string &filename, const FILETIME &result)
|
||||
{
|
||||
HANDLE handle = CreateFile (filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE handle = CreateFile (utf8ToTStr(filename), GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle)
|
||||
{
|
||||
SetFileTime (handle, NULL, NULL, &result);
|
||||
|
@ -460,7 +460,7 @@ void CData_mirrorDlg::OnOK()
|
|||
createDirectory (directory.c_str ());
|
||||
if (!CopyFile (source.c_str (), dest.c_str (), FALSE))
|
||||
{
|
||||
MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), "NeL Data Mirror",
|
||||
MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), _T("NeL Data Mirror"),
|
||||
MB_OK|MB_ICONEXCLAMATION);
|
||||
success = false;
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ void CData_mirrorDlg::OnOK()
|
|||
createDirectory (directory.c_str ());
|
||||
if (!CopyFile (source.c_str (), dest.c_str (), FALSE))
|
||||
{
|
||||
MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), "NeL Data Mirror",
|
||||
MessageBox (("Can't copy file "+source+" in file "+dest).c_str (), _T("NeL Data Mirror"),
|
||||
MB_OK|MB_ICONEXCLAMATION);
|
||||
success = false;
|
||||
}
|
||||
|
@ -534,7 +534,7 @@ void CData_mirrorDlg::OnOK()
|
|||
|
||||
if (!DeleteFile (dest.c_str ()))
|
||||
{
|
||||
MessageBox (("Can't delete the file "+dest).c_str (), "NeL Data Mirror",
|
||||
MessageBox (("Can't delete the file "+dest).c_str (), _T("NeL Data Mirror"),
|
||||
MB_OK|MB_ICONEXCLAMATION);
|
||||
success = false;
|
||||
}
|
||||
|
@ -594,9 +594,9 @@ void CData_mirrorDlg::OnSize(UINT nType, int cx, int cy)
|
|||
resize ();
|
||||
}
|
||||
|
||||
bool getFileTime (const char *filename, FILETIME &result)
|
||||
bool getFileTime (const std::string &filename, FILETIME &result)
|
||||
{
|
||||
HANDLE handle = CreateFile (filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE handle = CreateFile (utf8ToTStr(filename), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle)
|
||||
{
|
||||
FILETIME res0;
|
||||
|
@ -637,8 +637,8 @@ void CData_mirrorDlg::buildSourceFiles ()
|
|||
{
|
||||
FILETIME time0;
|
||||
FILETIME time1;
|
||||
getFileTime (mirrorFile.c_str (), time0);
|
||||
getFileTime (mainFile.c_str (), time1);
|
||||
getFileTime (mirrorFile, time0);
|
||||
getFileTime (mainFile, time1);
|
||||
sint64 deltaInt = (((uint64)time1.dwHighDateTime)<<32|((uint64)time1.dwLowDateTime)) - (((uint64)time0.dwHighDateTime)<<32|((uint64)time0.dwLowDateTime));
|
||||
double deltaInSec = (double)deltaInt;
|
||||
deltaInSec /= 10000000.0;
|
||||
|
@ -688,8 +688,8 @@ void CData_mirrorDlg::buildSourceFiles ()
|
|||
{
|
||||
// Update time stamp
|
||||
FILETIME fileTime;
|
||||
getFileTime (mainFile.c_str (), fileTime);
|
||||
setFileTime (mirrorFile.c_str(), fileTime);
|
||||
getFileTime (mainFile, fileTime);
|
||||
setFileTime (mirrorFile, fileTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -699,8 +699,8 @@ void CData_mirrorDlg::buildSourceFiles ()
|
|||
else
|
||||
{
|
||||
FILETIME time;
|
||||
getFileTime (mainFile.c_str (), time);
|
||||
addEntry (Added, str.c_str (), time, time);
|
||||
getFileTime (mainFile, time);
|
||||
addEntry (Added, str, time, time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -777,7 +777,7 @@ void CData_mirrorDlg::addEntry (uint where, const char *filename, FILETIME &newD
|
|||
file.Strings[CEntryFile::Path] = filename;
|
||||
file.NewDateST = newDate;
|
||||
file.OldDateST = oldDate;
|
||||
const char *aFilename;
|
||||
std::string aFilename;
|
||||
|
||||
string mirrorFile = MirrorDirectory+filename;
|
||||
string mainFile = MainDirectory+filename;
|
||||
|
@ -790,7 +790,7 @@ void CData_mirrorDlg::addEntry (uint where, const char *filename, FILETIME &newD
|
|||
|
||||
// Date
|
||||
timeToString (file.Strings[CEntryFile::OldDate], oldDate);
|
||||
aFilename = mirrorFile.c_str ();
|
||||
aFilename = mirrorFile;
|
||||
}
|
||||
|
||||
if (where != Removed)
|
||||
|
@ -801,7 +801,7 @@ void CData_mirrorDlg::addEntry (uint where, const char *filename, FILETIME &newD
|
|||
|
||||
// Date
|
||||
timeToString (file.Strings[CEntryFile::NewDate], newDate);
|
||||
aFilename = mainFile.c_str ();
|
||||
aFilename = mainFile;
|
||||
}
|
||||
|
||||
// Get the extension
|
||||
|
@ -811,19 +811,19 @@ void CData_mirrorDlg::addEntry (uint where, const char *filename, FILETIME &newD
|
|||
{
|
||||
// Get the image
|
||||
SHFILEINFO sfi;
|
||||
char winName[512];
|
||||
strcpy (winName, aFilename);
|
||||
char *ptr = winName;
|
||||
TCHAR winName[512];
|
||||
_tcscpy (winName, utf8ToTStr(aFilename));
|
||||
TCHAR *ptr = winName;
|
||||
while (*ptr)
|
||||
{
|
||||
if (*ptr=='/')
|
||||
*ptr = '\\';
|
||||
if (*ptr==_T('/'))
|
||||
*ptr = _T('\\');
|
||||
ptr++;
|
||||
}
|
||||
SHGetFileInfo (winName, 0, &sfi, sizeof (SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON | SHGFI_LINKOVERLAY | SHGFI_TYPENAME );
|
||||
|
||||
CExtension extension;
|
||||
extension.Description = sfi.szTypeName;
|
||||
extension.Description = tStrToUtf8(sfi.szTypeName);
|
||||
extension.Icon = sfi.iIcon;
|
||||
ite = MapExtensions.insert (std::map<string, CExtension>::value_type (ext, extension)).first;
|
||||
}
|
||||
|
@ -883,7 +883,7 @@ void CData_mirrorDlg::OnUpdate()
|
|||
CString itemText = List.GetItemText (i, 0);
|
||||
|
||||
// Add to ignore good list
|
||||
entriesToUpdate.push_back ((const char*)itemText);
|
||||
entriesToUpdate.push_back (tStrToUtf8(itemText));
|
||||
|
||||
// Remove from the file list
|
||||
std::list<CEntryFile>::iterator *ite = (std::list<CEntryFile>::iterator *)List.GetItemData (i);
|
||||
|
|
|
@ -71,7 +71,7 @@ BOOL CFilterDialog::OnInitDialog()
|
|||
|
||||
if ( Trace )
|
||||
{
|
||||
GetDlgItem( IDC_PosFilterCap )->SetWindowText( "Service code" );
|
||||
GetDlgItem( IDC_PosFilterCap )->SetWindowText(_T("Service code"));
|
||||
GetDlgItem( IDC_NegFilterCap )->ShowWindow( SW_HIDE );
|
||||
GetDlgItem( IDC_SepCap )->ShowWindow( SW_HIDE );
|
||||
GetDlgItem( IDC_NegFilter )->ShowWindow( SW_HIDE );
|
||||
|
@ -79,11 +79,11 @@ BOOL CFilterDialog::OnInitDialog()
|
|||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem( IDC_PosFilterCap )->SetWindowText( "Positive filters (all lines must contain one of these substrings)" );
|
||||
GetDlgItem( IDC_PosFilterCap )->SetWindowText(_T("Positive filters (all lines must contain one of these substrings)"));
|
||||
GetDlgItem( IDC_NegFilterCap )->ShowWindow( SW_SHOW );
|
||||
GetDlgItem( IDC_SepCap )->ShowWindow( SW_SHOW );
|
||||
GetDlgItem( IDC_NegFilter )->ShowWindow( SW_SHOW );
|
||||
GetDlgItem( IDC_Sep )->SetWindowText( ";" );
|
||||
GetDlgItem( IDC_Sep )->SetWindowText(_T(";"));
|
||||
GetDlgItem( IDC_Sep )->ShowWindow( SW_SHOW );
|
||||
}
|
||||
|
||||
|
@ -98,12 +98,12 @@ std::vector<CString> buildVectorFromString( const CString& str, const CString& s
|
|||
{
|
||||
std::vector<CString> vec;
|
||||
CString str2 = str;
|
||||
char *token;
|
||||
token = strtok( str2.GetBuffer( str2.GetLength() ), sep );
|
||||
TCHAR *token;
|
||||
token = _tcstok( str2.GetBuffer( str2.GetLength() ), sep );
|
||||
while ( token != NULL )
|
||||
{
|
||||
vec.push_back( CString(token) );
|
||||
token = strtok( NULL, sep );
|
||||
token = _tcstok( NULL, sep );
|
||||
}
|
||||
str2.ReleaseBuffer();
|
||||
return vec;
|
||||
|
|
|
@ -147,8 +147,8 @@ void CPlugInSelector::OnSelchangeList1()
|
|||
AfxMessageBox( _T("Can't find function getInfoString in dll") );
|
||||
return;
|
||||
}
|
||||
GetDlgItem( IDC_GROUP_INFO )->SetWindowText( getFilename( string(dllName)).c_str() );
|
||||
GetDlgItem( IDC_PLUGIN_INFO )->SetWindowText( infoFunc().c_str() );
|
||||
GetDlgItem( IDC_GROUP_INFO )->SetWindowText( utf8ToTStr(getFilename(tStrToUtf8(dllName))) );
|
||||
GetDlgItem( IDC_PLUGIN_INFO )->SetWindowText(utf8ToTStr(infoFunc()) );
|
||||
|
||||
// Prepare analyse func
|
||||
AnalyseFunc = (TAnalyseFunc)GetProcAddress( LibInst, "doAnalyse" );
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <nel/misc/ucstring.h>
|
||||
#include <nel/misc/common.h>
|
||||
#include <nel/misc/file.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
|
|
@ -301,14 +301,14 @@ void CViewDialog::reload()
|
|||
{
|
||||
SessionDatePassed = false;
|
||||
CWaitCursor wc;
|
||||
if ( LogSessionStartDate.IsEmpty() || (LogSessionStartDate == "Beginning") )
|
||||
if ( LogSessionStartDate.IsEmpty() || (LogSessionStartDate == _T("Beginning")) )
|
||||
{
|
||||
SessionDatePassed = true;
|
||||
}
|
||||
|
||||
((CButton*)GetDlgItem( IDC_BUTTON1 ))->ShowWindow( SW_SHOW );
|
||||
((CButton*)GetDlgItem( IDC_BUTTON2 ))->ShowWindow( SW_SHOW );
|
||||
m_Caption.Format( "%s (%u file%s) %u+ %u- (%s)", Seriesname, Filenames.size(), Filenames.size()>1?"s":"", PosFilter.size(), NegFilter.size(), LogSessionStartDate.IsEmpty()?"all":CString("session ")+LogSessionStartDate );
|
||||
m_Caption.Format( _T("%s (%u file%s) %u+ %u- (%s)"), Seriesname, Filenames.size(), Filenames.size()>1?"s":"", PosFilter.size(), NegFilter.size(), LogSessionStartDate.IsEmpty()?"all":CString("session ")+LogSessionStartDate );
|
||||
UpdateData( false );
|
||||
clear();
|
||||
setRedraw( false );
|
||||
|
@ -356,17 +356,21 @@ void CViewDialog::getBookmarksAbsoluteLines( vector<int>& bookmarksAbsoluteLine
|
|||
for ( unsigned int i=0; i!=Filenames.size(); ++i )
|
||||
{
|
||||
CString& filename = Filenames[i];
|
||||
ifstream ifs( filename );
|
||||
if ( ! ifs.fail() )
|
||||
|
||||
NLMISC::CIFile ifs;
|
||||
|
||||
if (ifs.open(tStrToUtf8(filename)))
|
||||
{
|
||||
char line [1024];
|
||||
while ( ! ifs.eof() )
|
||||
|
||||
while (!ifs.eof())
|
||||
{
|
||||
ifs.getline( line, 1024 );
|
||||
ifs.getline(line, 1024);
|
||||
|
||||
if ( SessionDatePassed )
|
||||
{
|
||||
// Stop if the session is finished
|
||||
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, LogDateString )) )
|
||||
if ( (! LogSessionStartDate.IsEmpty()) && (strstr( line, tStrToUtf8(LogDateString).c_str())) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -390,7 +394,7 @@ void CViewDialog::getBookmarksAbsoluteLines( vector<int>& bookmarksAbsoluteLine
|
|||
else
|
||||
{
|
||||
// Look for the session beginning
|
||||
if ( strstr( line, LogSessionStartDate ) != NULL )
|
||||
if ( strstr( line, tStrToUtf8(LogSessionStartDate).c_str()) != NULL )
|
||||
{
|
||||
SessionDatePassed = true;
|
||||
}
|
||||
|
@ -457,15 +461,12 @@ std::string CViewDialog::corruptedLinesString( const std::vector<unsigned int>&
|
|||
string res;
|
||||
if ( ! corruptedLines.empty() )
|
||||
{
|
||||
CString s;
|
||||
s.Format( "%u", corruptedLines.size() );
|
||||
res = " -> " + string(s) + " corrupted lines:";
|
||||
res = NLMISC::toString(" -> %u corrupted lines:", (uint)corruptedLines.size());
|
||||
|
||||
vector<unsigned int>::const_iterator ivc;
|
||||
for ( ivc=corruptedLines.begin(); ivc!=corruptedLines.end(); ++ivc )
|
||||
{
|
||||
s.Format( "%u", *ivc );
|
||||
res += "\r\n line " + string(s) + " : " + string(Buffer[*ivc].Left(20)) + "...";
|
||||
res += NLMISC::toString("\r\n line %u : %s...", *ivc, tStrToUtf8(Buffer[*ivc].Left(20)).c_str());
|
||||
}
|
||||
HasCorruptedLines = true;
|
||||
}
|
||||
|
|
|
@ -620,7 +620,7 @@ void CLog_analyserDlg::getLogSeries( const CString& filenameStr, std::vector<CSt
|
|||
{
|
||||
if ( isLogSeriesEnabled() )
|
||||
{
|
||||
string filename = filenameStr;
|
||||
string filename = tStrToUtf8(filenameStr);
|
||||
unsigned int dotpos = filename.find_last_of ('.');
|
||||
if ( dotpos != string::npos )
|
||||
{
|
||||
|
@ -1012,13 +1012,13 @@ void CLog_analyserDlg::OnAnalyse()
|
|||
{
|
||||
if ( Views.empty() )
|
||||
{
|
||||
AfxMessageBox( "This plug-in needs to be applied on the first open view" );
|
||||
AfxMessageBox(_T("This plug-in needs to be applied on the first open view"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! PlugInSelectorDialog.AnalyseFunc )
|
||||
{
|
||||
AfxMessageBox( "Could not load function doAnalyse in dll" );
|
||||
AfxMessageBox(_T("Could not load function doAnalyse in dll"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ void CLog_analyserDlg::OnAnalyse()
|
|||
if ( ! logstr.empty() )
|
||||
{
|
||||
vector<CString> pl;
|
||||
pl.push_back( "Analyse log" );
|
||||
pl.push_back(_T("Analyse log"));
|
||||
onAddCommon( pl );
|
||||
Views.back()->addText( logstr.c_str() );
|
||||
Views.back()->commitAddedLines();
|
||||
|
@ -1041,7 +1041,7 @@ void CLog_analyserDlg::OnAnalyse()
|
|||
if ( nEndChar != (int)resstr.size() )
|
||||
{
|
||||
CString s;
|
||||
s.Format( "Error: plug-in returned %u characters, only %d displayed", resstr.size(), nEndChar+1 );
|
||||
s.Format(_T("Error: plug-in returned %u characters, only %d displayed"), (uint)resstr.size(), nEndChar+1 );
|
||||
AfxMessageBox( s );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,12 +87,12 @@ BOOL CWords_dicDlg::OnInitDialog()
|
|||
SplashScreen->Create( IDD_SplashScreen, NULL );
|
||||
SplashScreen->ShowWindow( SW_SHOW );
|
||||
SplashScreen->SetWindowPos( &wndTop, 400, 300, 0,0, SWP_NOSIZE );
|
||||
SplashScreen->GetDlgItem( IDC_SplashText )->SetWindowText( "Please wait while loading dictionary..." );
|
||||
SplashScreen->GetDlgItem( IDC_SplashText )->SetWindowText( _T("Please wait while loading dictionary...") );
|
||||
if ( ! Dico.init() )
|
||||
AfxMessageBox( "Can't init dictionary, see reason in log.log" );
|
||||
AfxMessageBox( _T("Can't init dictionary, see reason in log.log") );
|
||||
SplashScreen->DestroyWindow();
|
||||
delete SplashScreen;
|
||||
GetDlgItem( IDC_Status )->SetWindowText( "Tip: ^ and $ can be used to represent the start and the end of string" );
|
||||
GetDlgItem( IDC_Status )->SetWindowText( _T("Tip: ^ and $ can be used to represent the start and the end of string") );
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
@ -157,13 +157,13 @@ void CWords_dicDlg::lookUp( const CString& inputStr )
|
|||
{
|
||||
// Look up
|
||||
CVectorSString resultVec;
|
||||
Dico.lookup( CSString(inputStr), resultVec );
|
||||
Dico.lookup( tStrToUtf8(inputStr), resultVec );
|
||||
|
||||
// Display results
|
||||
clear();
|
||||
if ( resultVec.empty() )
|
||||
{
|
||||
m_Results.AddString( "<no result>" );
|
||||
m_Results.AddString(_T("<no result>"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
@ -176,14 +176,14 @@ void CWords_dicDlg::lookUp( const CString& inputStr )
|
|||
const CSString& res = (*ivs);
|
||||
if ( showAll || (res.find( "lvl" ) == string::npos) )
|
||||
{
|
||||
m_Results.AddString( res.c_str() );
|
||||
m_Results.AddString( utf8ToTStr(res) );
|
||||
}
|
||||
else
|
||||
lvlRemoved = true;
|
||||
}
|
||||
m_Results.SetRedraw( true );
|
||||
CString s;
|
||||
s.Format( "%u results found for \"%s\".%s", resultVec.size(), inputStr, lvlRemoved?" Results containing \"lvl\" not shown":"" );
|
||||
s.Format(_T("%u results found for \"%s\".%s"), resultVec.size(), inputStr, lvlRemoved? _T(" Results containing \"lvl\" not shown"): _T("") );
|
||||
GetDlgItem( IDC_Status )->SetWindowText( s );
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void CWords_dicDlg::OnBtnFind()
|
|||
*/
|
||||
void CWords_dicDlg::clear()
|
||||
{
|
||||
GetDlgItem( IDC_Status )->SetWindowText( "" );
|
||||
GetDlgItem( IDC_Status )->SetWindowText(_T(""));
|
||||
m_Results.ResetContent();
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void CWords_dicDlg::clear()
|
|||
*/
|
||||
void CWords_dicDlg::OnBtnClear()
|
||||
{
|
||||
m_LookUp.SetWindowText( "" );
|
||||
m_LookUp.SetWindowText(_T(""));
|
||||
clear();
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ void CWords_dicDlg::OnFileList()
|
|||
const vector<string>& fileList = Dico.getFileList();
|
||||
for ( vector<string>::const_iterator ifl=fileList.begin(); ifl!=fileList.end(); ++ifl )
|
||||
{
|
||||
m_Results.AddString( (*ifl).c_str() );
|
||||
m_Results.AddString( utf8ToTStr(*ifl) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ void CWords_dicDlg::OnSelchangeResultList()
|
|||
// Get selection
|
||||
CString resStr;
|
||||
m_Results.GetText( m_Results.GetCurSel(), resStr );
|
||||
CSString key = Dico.getWordsKey( CSString(resStr) );
|
||||
CSString key = Dico.getWordsKey( tStrToUtf8(resStr) );
|
||||
|
||||
// Copy the selection into the clipboard
|
||||
if ( OpenClipboard() )
|
||||
|
@ -271,13 +271,13 @@ void CWords_dicDlg::OnSelchangeResultList()
|
|||
if ( mem )
|
||||
{
|
||||
CString s;
|
||||
s.Format( "\"%s\" copied into the clipboard", key.c_str() );
|
||||
s.Format(_T("\"%s\" copied into the clipboard"), utf8ToTStr(key) );
|
||||
GetDlgItem( IDC_Status )->SetWindowText( s );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetDlgItem( IDC_Status )->SetWindowText( "Cannot access the clipboard" );
|
||||
GetDlgItem( IDC_Status )->SetWindowText(_T("Cannot access the clipboard"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue