[Com0com-cvs] com0com/setupg Form1.h, 1.4, 1.5 portprms.cpp, 1.1, 1.2 portprms.h, 1.1, 1.2
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2009-01-12 13:04:15
|
Update of /cvsroot/com0com/com0com/setupg In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26879 Modified Files: Form1.h portprms.cpp portprms.h Log Message: Added red painting InUse portnames Index: portprms.h =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/portprms.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** portprms.h 31 Oct 2007 10:16:55 -0000 1.1 --- portprms.h 12 Jan 2009 13:04:07 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2007-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,27 **** * * $Log$ * Revision 1.1 2007/10/31 10:16:55 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2009/01/12 13:04:07 vfrolov + * Added red painting InUse portnames + * * Revision 1.1 2007/10/31 10:16:55 vfrolov * Initial revision * */ *************** *** 57,64 **** --- 59,69 ---- void RemovePair(String ^keyPair); void ChangePair(String ^keyPair, PortPair ^pairChanges); + bool IsValidName(String ^name); private: String ^ParseLine(String ^line); + void LoadBusyNames(); + array<String ^> ^busyNames; System::Windows::Forms::Control ^parent; }; Index: Form1.h =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/Form1.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Form1.h 4 May 2008 09:56:47 -0000 1.4 --- Form1.h 12 Jan 2009 13:04:07 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2007-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2007-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2009/01/12 13:04:07 vfrolov + * Added red painting InUse portnames + * * Revision 1.4 2008/05/04 09:56:47 vfrolov * Implemented HiddenMode option *************** *** 540,543 **** --- 543,555 ---- } + bool IsValidValue(String ^key, String ^value) { + if (key == "portname") { + if (!pairs->IsValidName(value)) + return false; + } + + return true; + } + ///////////////////////////////////////////////////////////////////// #define DeclareControlPair(controlClass, control) \ *************** *** 557,561 **** String ^value = GetControlValue(control##s[i])->ToUpper(); \ if (pairs[pairList->SelectedNode->Name][i][key] != value) { \ ! control##s[i]->ForeColor = Color::Blue; \ return; \ } \ --- 569,573 ---- String ^value = GetControlValue(control##s[i])->ToUpper(); \ if (pairs[pairList->SelectedNode->Name][i][key] != value) { \ ! control##s[i]->ForeColor = (IsValidValue(key, value) ? Color::Blue : Color::Red); \ return; \ } \ *************** *** 624,628 **** TreeNode ^pair; bool pairExpand; ! if (pairList->Nodes->ContainsKey(kvpPair.Key)) { pair = pairList->Nodes[kvpPair.Key]; --- 636,640 ---- TreeNode ^pair; bool pairExpand; ! if (pairList->Nodes->ContainsKey(kvpPair.Key)) { pair = pairList->Nodes[kvpPair.Key]; *************** *** 718,722 **** System::Windows::Forms::DialogResult res; ! res = MessageBox::Show(this, msg, "Apply", MessageBoxButtons::YesNoCancel); --- 730,734 ---- System::Windows::Forms::DialogResult res; ! res = MessageBox::Show(this, msg, "Apply", MessageBoxButtons::YesNoCancel); *************** *** 755,759 **** pinMap->Paint(e, picturePinMap); } ! Void picturePinMap_MouseDown(Object ^/*sender*/, MouseEventArgs ^e) { pinMap->MouseDown(e); --- 767,771 ---- pinMap->Paint(e, picturePinMap); } ! Void picturePinMap_MouseDown(Object ^/*sender*/, MouseEventArgs ^e) { pinMap->MouseDown(e); *************** *** 784,788 **** Void pairsList_BeforeSelect(Object ^/*sender*/, TreeViewCancelEventArgs ^e) { ! if (e->Node->Level != 0 || !SaveChanges()) e->Cancel = true; } --- 796,800 ---- Void pairsList_BeforeSelect(Object ^/*sender*/, TreeViewCancelEventArgs ^e) { ! if (!SaveChanges()) e->Cancel = true; } *************** *** 808,812 **** System::Windows::Forms::DialogResult res; ! res = MessageBox::Show(this, msg, "", MessageBoxButtons::YesNo); --- 820,824 ---- System::Windows::Forms::DialogResult res; ! res = MessageBox::Show(this, msg, "", MessageBoxButtons::YesNo); Index: portprms.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/portprms.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** portprms.cpp 31 Oct 2007 10:16:55 -0000 1.1 --- portprms.cpp 12 Jan 2009 13:04:07 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2007-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,27 **** * * $Log$ * Revision 1.1 2007/10/31 10:16:55 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2009/01/12 13:04:07 vfrolov + * Added red painting InUse portnames + * * Revision 1.1 2007/10/31 10:16:55 vfrolov * Initial revision * */ *************** *** 91,94 **** --- 93,98 ---- for (int i = 0 ; i < lines->Length ; i++) ParseLine(lines[i]); + + LoadBusyNames(); } *************** *** 108,111 **** --- 112,117 ---- } + LoadBusyNames(); + return res; } *************** *** 137,138 **** --- 143,164 ---- Init(); } + + bool PortPairs::IsValidName(String ^name) + { + if (busyNames == nullptr) + return true; + + for each (String ^busyName in busyNames) { + if (busyName->ToUpper() == name->ToUpper()) + return false; + } + + return true; + } + + void PortPairs::LoadBusyNames() + { + String ^cmd = "busynames *"; + + busyNames = ExecCommand::ExecCommand(parent, cmd); + } |