Exemplo n.º 1
0
void sChoiceControl::FakeDropdown(sInt x,sInt y)
{
  sMenuFrame *mf;
  ChoiceInfo *ci;

  sWindow *w=this;
  sInt max = 1;
  if(w->Parent==0)
  {
    max = 20;
  }
  else
  {
    while (w->Parent) w=w->Parent;
    max=sMax(1,w->Client.SizeY()/(sGui->PropFont->GetHeight()+2));
  }
  sInt n=0;
  mf = new sMenuFrame(this);
  if(Values.GetCount()>=2)
    mf->AddItem(L"(differ)",sMessage(this,&sChoiceControl::SetDefaultValue,0),0,-1,n++/max);
  sFORALL(Choices,ci)
  {
    sVERIFY(ci->Value<0x40000000);
    mf->AddItem(ci->Label,sMessage(this,&sChoiceControl::SetValue,ci->Value),0,ci->Length,n++/max);
  }
Exemplo n.º 2
0
void sDialogWindow::Start()
{
    if(LeftLabel)
    {
        LeftButton = AddButton(LeftLabel,sMessage(this,&sDialogWindow::CmdLeft));
        LeftButton->Width = 75;
    }
    if(RightLabel)
    {
        RightButton = AddButton(RightLabel,sMessage(this,&sDialogWindow::CmdRight));
        RightButton->Width = 75;
    }
    if(EditString.Buffer)
    {
        EditControl = new sStringControl(EditString);
        AddChild(EditControl);
    }
    if(PoolString)
    {
        EditControl = new sStringControl(PoolString);
        AddChild(EditControl);
    }

    OnCalcSize();
    sGui->AddFloatingWindow(this,Header);
    if(EditControl)
    {
        sGui->SetFocus(EditControl);
        //  EditControl->DoneMsg = sMessage(this,&sDialogWindow::CmdRight);
    }
}
Exemplo n.º 3
0
MyParentWin::MyParentWin()
{
  sVSplitFrame *v;
  sToolBorder *tb;

  for(sInt i=0;i<4;i++)
  {
    v = new sVSplitFrame;
    for(sInt j=0;j<4;j++)
    {
      sWindow *w;
      if(i==2 && j==2)
      {
        sTextWindow *t = new sTextWindow;
        t->SetText(&Text);
        Text.PrintF(L"lk jsalk dsf fasd fdsfdkl asjd\n123456789\nabcdefghijklmnop\nnlhdlhefhdsjf hdkfh sldjhf");
        t->TextFlags |= sF2P_MULTILINE;
        w = t;
      }
      else
      {
        w = new MyWindow;
      }
      w->AddBorder(new sFocusBorder);
      v->AddChild(w);
    }
    v->AddBorder(new sFocusBorder);
    AddChild(v);
  }
  tb = new sToolBorder;
  tb->AddMenu(L"File",sMessage(this,&MyParentWin::MakeMenu));
  tb->AddMenu(L"View",sMessage());
  AddBorder(tb);
}
Exemplo n.º 4
0
void MyParentWin::MakeMenu()
{
  sMenuFrame *mf;
  mf = new sMenuFrame(this);
  mf->AddItem(L"first",sMessage(),0);
  mf->AddItem(L"second",sMessage(),0);
  mf->AddSpacer();
  mf->AddItem(L"last",sMessage(),0);
  sGui->AddPulldownWindow(mf);
}
Exemplo n.º 5
0
void ElementRatings::LogMetadataElements(const Metawall::IMWMetadataElementsPtr spElements, const CStdString& message)
{
	try
	{
		if(!Workshare::Logging::ShouldLogInfo())
			return;

		CStdString sMessage(_T("Selected Elements. "));
		sMessage.append(message);

		for(long index = 1; index <= spElements->Count; index++)
		{	
			Metawall::IMWMetadataElementPtr spElement(spElements->Item[index]);
			CStdString sEnabled = (VARIANT_FALSE != spElement->Enabled) ? _T("1") : _T("0");
			sMessage.AppendFormat(_T("\n:%s = %s"), CStdString(spElement->Name).c_str(), sEnabled.c_str());
		}
		LOG_WS_INFO(sMessage.c_str());	
	}
	catch(_com_error const& e)
	{
		LOG_WS_ERROR_RESULT(e);
	}
	catch(...)
	{
		LOG_WS_ERROR(_T("Failed to log. Unknown exception"));	
	}
}
Exemplo n.º 6
0
void MainWindow::CmdDialog()
{
  sMultipleChoiceDialog *diag = new sMultipleChoiceDialog(L"multiple choice test",
    L"click one of these buttons to exit\n"
    L"This is supposed to be a longer text. so i add some random stuff in here.\n"
    L"It's massive. It takes my breath away. It definitely is a solid piece both artistically and technically.\n"
    L"Kasparov is what I immediately drew comparisons to. They share the idea of a machine-generated world that "
/*
    L"at first look seems like a real one, the surface cracking to show the cold dark unreal nature. While "
    L"Kasparov ultimately left it at that despite making the disconnect more and more apparent as the demo "
    L"progressed, Debris ends in the extreme, ripping the whole world apart, leaving only static behind.\n"
    L"It's a really well designed whole where each and every part works toward the desired effect. Should not be missed."
    */
  );
  diag->AddItem(L"Save & Quit",sMessage(),'s');
  diag->AddItem(L"Quit without Saving",sMessage(),'q');
  diag->AddItem(L"Do not Quit",sMessage(),sKEY_ESCAPE);
  diag->Start();
}
Exemplo n.º 7
0
sFileDialogControl::sFileDialogControl(const sStringDesc &string,const sChar *text,const sChar *ext,sInt flags) : String(string)
{
  Text = text;
  Extensions = ext;
  Label = L"...";
  if(flags)
    Flags = flags;
  else
    Flags = sSOF_LOAD;
  DoneMsg = sMessage(this,&sFileDialogControl::CmdStart);
}
Exemplo n.º 8
0
//========================================================================================
// Send a char string to the console
void WPConsole_cl::send(char* szMessage, ...)
{
	va_list argptr;
	char msg[512];
	va_start(argptr, szMessage);
	vsnprintf(msg,512, szMessage, argptr);
	va_end(argptr);
	
	string sMessage(msg);
	send(sMessage);
}
Exemplo n.º 9
0
WinFrame::WinFrame()
{
  Grid = new sGridFrame;
  AddChild(Grid);
  Grid->Columns = 12;

  ClearNotify();
//  AddNotify(App->ints,sizeof(App->ints);
//  AddNotify(App->strings,sizeof(App->strings);
//  AddNotify(App->floats,sizeof(App->floats);

  sGridFrameHelper gh(Grid);
  gh.DoneMsg = sMessage(App,&MainWindow::UpdateText,1000);
  gh.ChangeMsg = sMessage(App,&MainWindow::UpdateText,1001);
  gh.Reset();
  gh.Group(L"Buttons");
  gh.Label(L"pushbuttons");
  gh.PushButton(L"push A",sMessage(App,&MainWindow::UpdateText,1));
  gh.PushButton(L"push B",sMessage(App,&MainWindow::UpdateText,2));
  gh.Box(L"->",sMessage(App,&MainWindow::UpdateText,3));
  gh.Box(L"...",sMessage(App,&MainWindow::UpdateText,4));
  gh.Label(L"radio buttons");
  gh.Radio(&App->ints[2],L"A|B|C|D|E|F|G",2);
  gh.Label(L"choices");
  gh.Choice(&App->ints[0],L"off|on");
  gh.Choice(&App->ints[1],L" 0| 1| 2| 3");
  gh.Choice(&App->ints[1],L"*4bli|bla|blub");
  gh.Label(L"Flags");
  gh.Flags(&App->ints[3],L"on|off:*1zero|one:*2A|B|C|:*4-|action");
  gh.Group(L"Text");
  gh.Label(L"String");
  gh.String(App->strings[0]);
  gh.Label(L"int");
  gh.Int(&App->ints[4],0,16,0.25f);
  gh.Int(&App->ints[5],-1024,1024,16);
  gh.Label(L"float");
  gh.Float(&App->floats[0],0,16,0.25f);
  gh.Float(&App->floats[1],-1024,1024,16);
  gh.Label(L"byte");
  gh.Byte((sU8*)&App->ints[6],0,16,0.25f);
  gh.Byte((sU8*)&App->ints[7],0,255,16);
  gh.Group(L"Colors");
  gh.Label(L"byte rgb");
  gh.Color((sU32 *)&App->ints[8],L"rgb");
  gh.Label(L"byte rgba");
  gh.Color((sU32 *)&App->ints[9],L"rgba");
  gh.Label(L"float rgb");
  gh.ColorF(&App->floats[8],L"rgb");
  gh.Label(L"float rgba");
  gh.ColorF(&App->floats[12],L"rgba");

  sWire->AddDrag(L"Frame",L"Scroll",sMessage(this,&WinFrame::DragScroll,0));
  Default = 0;
}
Exemplo n.º 10
0
	void CModelReaderWarnings::addException(const _In_ CNMRException & Exception, _In_ eModelReaderWarningLevel WarningLevel)
	{
		if (m_Warnings.size() < NMR_MAXWARNINGCOUNT) { // Failsafe check for Index overflows
			std::string sAsciiMessage (Exception.what());
			std::wstring sMessage (sAsciiMessage.begin(), sAsciiMessage.end());

			PModelReaderWarning pWarning = std::make_shared<CModelReaderWarning>(sMessage, WarningLevel, Exception.getErrorCode());
			m_Warnings.push_back(pWarning);
		}

		if ((nfInt32)WarningLevel <= (nfInt32)m_CriticalWarningLevel)
			throw Exception;
	}
Exemplo n.º 11
0
ret_ CXMLLoaderActions::LoadAlert(CProgram &Program,
								  const DOMElement *pElement)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif
	
	auto_xerces_str wsMessage("message");
	auto_xerces_str sMessage(pElement->getAttribute(wsMessage));
	COptAlert *pOpt = new COptAlert(sMessage);

	if (false_v == Program.AddOperator(pOpt))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
Exemplo n.º 12
0
CString CPop3Message::GetHeader() const
{
	//Value which will be returned by this function
	CString sHeader;
	
	//Find the divider between the header and body
	CString sMessage(m_pszMessage);
	int nFind = sMessage.Find(_T("\r\n\r\n"));
	if (nFind != -1)
		sHeader = sMessage.Left(nFind);
	else
	{
		//No divider, then assume all the text is the header
		sHeader = sMessage;
	}
	
	return sHeader;
}
Exemplo n.º 13
0
void NetworkSyncManager::DisplayStartupStatus()
{
	CString sMessage("");

	switch (m_startupStatus)
	{
	case 0:
		//Networking wasn't attepmpted
		return;
	case 1:
		sMessage = "Connection to " + m_ServerName + " sucessful.";
		break;
	case 2:
		sMessage = "Connection failed.";
		break;
	}
	SCREENMAN->SystemMessage(sMessage);
}
Exemplo n.º 14
0
void PathProp::OnPathPropMenuSelected( wxCommandEvent& event )
{
    switch( event.GetId() ) {
        case ID_PATHPROP_MENU_DELETE: {
            long item = -1;
            item = m_opList->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
            if( item == -1 ) break;

            ODPoint *op;
            op = (ODPoint *) m_opList->GetItemData( item );

            wxString sMessage( wxS("Are you sure you want to remove this ") );
            wxString sCaption( wxS("OCPN Draw Remove ") );
            wxString sType( wxS("") );
            if (!op || op->GetTypeString().IsNull() || op->GetTypeString().IsEmpty() )
                sType.append( wxS("Point") );
            else
                sType.append( op->GetTypeString() );
            sMessage.append( sType );
            sMessage.append( wxS("?") );
            sCaption.append( sType );
            
            int dlg_return = OCPNMessageBox_PlugIn( this, sMessage, sCaption, (long) wxYES_NO | wxCANCEL | wxYES_DEFAULT );

            if( dlg_return == wxID_YES ) {
                m_pPath->RemovePointFromPath( op, m_pPath );
            }
            break;
        }
        case ID_PATHPROP_MENU_EDIT_WP: {
            long item = -1;

            item = m_opList->GetNextItem( item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );

            if( item == -1 ) break;

            ODPoint *op = (ODPoint *) m_opList->GetItemData( item );
            if( !op ) break;

            PathManagerDialog::ODPointShowPropertiesDialog( op, this );
            break;
        }
    }
}
Exemplo n.º 15
0
Arquivo: main.cpp Projeto: CCJY/coliru
int main(int argc, char *argv[]) {
    std::vector<Test *> vecTest;
    vecTest.push_back(new Test(1, "1"));
    vecTest.push_back(new Test(2, "2"));
    vecTest.push_back(new Test(3, "3"));
    vecTest.push_back(new Test(4, "4"));
    vecTest.push_back(new Test(5, "5"));
    vecTest.push_back(new Test(6, "6"));
    vecTest.push_back(new Test(7, "7"));
    
    int iIndex = 7;
    std::string sMessage("");
    if (!getTestById(vecTest, 7)) {
        sMessage = "";
    } else {
        sMessage = getTestById(vecTest, 7)->getMessage();
    }
    
    std::cout << sMessage << std::endl;
    
    printf("%s, Comando [%s]", "Funcion::test", 'a');
    
    return 0;
}
Exemplo n.º 16
0
BOOL CXmlFileEx::Decrypt(LPCTSTR szPassword)
{
	if (!IsEncrypted())
		return TRUE; // nothing to do
    
	// we don't try to decrypt if no encryption capabilities
	if (!CanEncrypt())
	{
		m_nFileError = XFL_NOENCRYPTIONDLL;
		return FALSE;
	}
	
	// use existing password if required
	if (!szPassword)
		szPassword = m_sPassword;

	CXmlItem* pXI = GetEncryptedBlock();
    
	if (pXI && !pXI->GetSibling())
	{
		// else keep getting password till success or user cancels
		while (TRUE)
		{
			CString sPassword(szPassword);
			
			if (sPassword.IsEmpty())
			{
				CString sExplanation(s_sPasswordExplanation);

				if (sExplanation.Find(_T("%s")) != -1)
					sExplanation.Format(s_sPasswordExplanation, GetFileName());
				
				if (!CPasswordDialog::RetrievePassword(FALSE, sPassword, sExplanation))
				{
					// RB - Set m_nFileError to avoid "The selected task list could not be opened..." message when cancelling
					m_nFileError = XFL_CANCELLED;
					return FALSE;
				}
			}
			
			CString sFile;
			
			if (Decrypt(pXI->GetValue(), sFile, sPassword))
			{
				m_sPassword = sPassword;
				
				sFile.TrimLeft();
				sFile.TrimRight();
				sFile = _T("<ROOT>") + sFile + _T("</ROOT>");
				
				// delete the cdata item
				m_xiRoot.DeleteItem(pXI);
				
				try
				{
					CXmlDocumentWrapper doc;
					
					// reparse decrypted xml
					if (doc.LoadXML(sFile))
					{
						CXmlNodeWrapper node(doc.AsNode());
						
						return ParseItem(m_xiRoot, &node);
					}
				}
				catch (...)
				{
					m_nFileError = XFL_BADMSXML;
				}
				
				return FALSE;
			}
			// RB - Added code to format the error message before calling AfxMessage
			else
			{
				CEnString sMessage(s_sDecryptFailed, GetFileName());

				if (IDNO == AfxMessageBox(sMessage, MB_YESNO))
				{
					m_nFileError = XFL_CANCELLED;
					return FALSE;
				}
				// else user will try again
			}
		}
	}
    
	// else
	m_nFileError = XFL_UNKNOWNENCRYPTION;
	return FALSE;
}
Exemplo n.º 17
0
void s3DWindow::InitWire(const sChar *name)
{
  sWireClientWindow::InitWire(name);
  sWire->AddKey(name,L"Reset",sMessage(this,&s3DWindow::CmdReset));
  sWire->AddKey(name,L"ResetTilt",sMessage(this,&s3DWindow::CmdResetTilt));
  sWire->AddKey(name,L"Grid",sMessage(this,&s3DWindow::CmdGrid));
  sWire->AddChoice(name,L"Grid_",sMessage(this,&s3DWindow::CmdGrid),&Grid,L"-|Grid");
  sWire->AddKey(name,L"QuakeCam",sMessage(this,&s3DWindow::CmdQuakeCam));
  sWire->AddKey(name,L"GearUp",sMessage(this,&s3DWindow::CmdGearShift,1));
  sWire->AddKey(name,L"GearDown",sMessage(this,&s3DWindow::CmdGearShift,-1));
  sWire->AddDrag(name,L"Dolly",sMessage(this,&s3DWindow::DragDolly));
  sWire->AddDrag(name,L"Zoom",sMessage(this,&s3DWindow::DragZoom));
  sWire->AddDrag(name,L"Orbit",sMessage(this,&s3DWindow::DragOrbit));
  sWire->AddDrag(name,L"Rotate",sMessage(this,&s3DWindow::DragRotate));
  sWire->AddDrag(name,L"Tilt",sMessage(this,&s3DWindow::DragTilt));
  sWire->AddDrag(name,L"Move",sMessage(this,&s3DWindow::DragMove));
  sWire->AddKey(name,L"QuakeForwToggle",sMessage(this,&s3DWindow::CmdQuakeForwToggle));
  sWire->AddKey(name,L"QuakeBackToggle",sMessage(this,&s3DWindow::CmdQuakeBackToggle));
  sWire->AddKey(name,L"QuakeLeftToggle",sMessage(this,&s3DWindow::CmdQuakeLeftToggle));
  sWire->AddKey(name,L"QuakeRightToggle",sMessage(this,&s3DWindow::CmdQuakeRightToggle));
  sWire->AddKey(name,L"QuakeUpToggle",  sMessage(this,&s3DWindow::CmdQuakeUpToggle));
  sWire->AddKey(name,L"QuakeDownToggle",sMessage(this,&s3DWindow::CmdQuakeDownToggle));
  sWire->AddKey(name,L"Screenshot",     sMessage(this,&s3DWindow::CmdScreenshot));
}
Exemplo n.º 18
0
void CApplication::OpenWindow(size_t iWidth, size_t iHeight, bool bFullscreen, bool bResizeable)
{
	glfwInit();

	m_bFullscreen = bFullscreen;

	if (HasCommandLineSwitch("--fullscreen"))
		m_bFullscreen = true;

	if (HasCommandLineSwitch("--windowed"))
		m_bFullscreen = false;

	m_iWindowWidth = iWidth;
	m_iWindowHeight = iHeight;

    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 0);
    glfwOpenWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);

	glfwOpenWindowHint(GLFW_WINDOW_RESIZABLE, bResizeable?GL_TRUE:GL_FALSE);

	if (m_bMultisampling)
		glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);

	if (HasCommandLineSwitch("--debug-gl"))
	{
		glfwOpenWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);

		if (!glDebugMessageCallbackARB)
			TMsg("Your drivers do not support GL_ARB_debug_output, so no GL debug output will be shown.\n");
	}

	glfwOpenWindowHint(GLFW_DEPTH_BITS, 16);
	glfwOpenWindowHint(GLFW_RED_BITS, 8);
	glfwOpenWindowHint(GLFW_GREEN_BITS, 8);
	glfwOpenWindowHint(GLFW_BLUE_BITS, 8);
	glfwOpenWindowHint(GLFW_ALPHA_BITS, 8);

	TMsg(sprintf(tstring("Opening %dx%d %s %s window.\n"), iWidth, iHeight, bFullscreen?"fullscreen":"windowed", bResizeable?"resizeable":"fixed-size"));

	if (!(m_pWindow = (size_t)glfwOpenWindow(iWidth, iHeight, m_bFullscreen?GLFW_FULLSCREEN:GLFW_WINDOWED, WindowTitle().c_str(), NULL)))
	{
		glfwTerminate();
		return;
	}

	int iScreenWidth;
	int iScreenHeight;

	GetScreenSize(iScreenWidth, iScreenHeight);

	if (!m_bFullscreen)
	{
		// The taskbar is at the bottom of the screen. Pretend the screen is smaller so the window doesn't clip down into it.
		// Also the window's title bar at the top takes up space.
		iScreenHeight -= 70;

		int iWindowX = (int)(iScreenWidth/2-m_iWindowWidth/2);
		int iWindowY = (int)(iScreenHeight/2-m_iWindowHeight/2);
		glfwSetWindowPos((GLFWwindow)m_pWindow, iWindowX, iWindowY);
	}

	glfwSetWindowCloseCallback(&CApplication::WindowCloseCallback);
	glfwSetWindowSizeCallback(&CApplication::WindowResizeCallback);
	glfwSetKeyCallback(&CApplication::KeyEventCallback);
	glfwSetCharCallback(&CApplication::CharEventCallback);
	glfwSetMousePosCallback(&CApplication::MouseMotionCallback);
	glfwSetMouseButtonCallback(&CApplication::MouseInputCallback);
	glfwSetScrollCallback(&CApplication::MouseWheelCallback);
	glfwSwapInterval( 1 );
	glfwSetTime( 0.0 );

	InitJoystickInput();

	SetMouseCursorEnabled(true);

	GLenum err = gl3wInit();
	if (0 != err)
		exit(0);

	DumpGLInfo();

	if (glDebugMessageCallbackARB)
	{
		glDebugMessageCallbackARB(GLDebugCallback, nullptr);

		tstring sMessage("OpenGL Debug Output Activated");
		glDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_OTHER_ARB, 0, GL_DEBUG_SEVERITY_LOW_ARB, sMessage.length(), sMessage.c_str());
	}

	glEnable(GL_CULL_FACE);
	glEnable(GL_DEPTH_TEST);
	glLineWidth(1.0);

	m_bIsOpen = true;

	m_pRenderer = CreateRenderer();
	m_pRenderer->Initialize();

	glgui::RootPanel()->SetSize((float)m_iWindowWidth, (float)m_iWindowHeight);
}
Exemplo n.º 19
0
inline sMessage sOpActionMessage(sDInt id) { return sMessage(App->ParaWin[0],&WinPara::CmdAction,id); }
Exemplo n.º 20
0
void CExportDlg::OnOK()
{
	BOOL bExporterHasFileExt = m_mgrImportExport.ExporterHasFileExtension(s_nFormatOption);

	if (bExporterHasFileExt)
	{
		m_sExportPath.TrimLeft();
		m_sExportPath.TrimRight();

		// if the export path is relative we build a path based
		// on the exe path and check with the user
		if (::PathIsRelative(m_sExportPath))
		{
			CString sPath = FileMisc::GetModuleFileName(), sDrive, sFolder;

			FileMisc::SplitPath(sPath, &sDrive, &sFolder);
			FileMisc::MakePath(sPath, sDrive, sFolder, m_sExportPath);

			CString sMessage;

			if (m_nExportOption == ALLTASKLISTS)
			{
				sMessage.Format(IDS_ED_CONFIRMEXPORTPATHMULTI, sPath);
			}
			else
			{
				sMessage.Format(IDS_ED_CONFIRMEXPORTPATH, sPath);
			}

			UINT nRet = MessageBox(sMessage, CEnString(IDS_ED_CONFIRMEXPORTPATH_TITLE), MB_YESNO);

			if (nRet == IDNO)
			{
				// re-display dialog
				m_eExportPath.SetSel(0, -1);
				m_eExportPath.SetFocus();
				return;
			}
			else
			{
				m_sExportPath = sPath;
			}
		}

		// make sure the output folder is valid
		BOOL bBadFolder = (m_nExportOption == ALLTASKLISTS && !m_bExportOneFile) ?
			!FileMisc::CreateFolder(m_sExportPath) :
			!FileMisc::CreateFolderFromFilePath(m_sExportPath);

		if (bBadFolder)
		{
			CEnString sMessage(IDS_ED_NOMAKEEXPORTPATH, m_sExportPath);

			UINT nRet = MessageBox(sMessage, CEnString(IDS_ED_NOMAKEEXPORTPATH_TITLE), MB_OKCANCEL);

			// re-display dialog
			if (nRet == IDOK)
			{
				m_eExportPath.SetSel(0, -1);
				m_eExportPath.SetFocus();
				return;
			}
			else
			{
				EndDialog(IDCANCEL);
				return;
			}
		}
	}

	CDialog::OnOK();

	// make sure extension is right
	if (bExporterHasFileExt)
	{
		if (m_nExportOption == ACTIVETASKLIST || m_bExportOneFile)
		{
			ReplaceExtension(m_sExportPath, s_nFormatOption);
		}
	}

	if (!m_bSingleTaskList)
	{
		CPreferences prefs;
		prefs.WriteProfileInt(_T("Exporting"), _T("ExportOption"), m_nExportOption);

		if (bExporterHasFileExt)
		{
			if (m_nExportOption == ALLTASKLISTS)
			{
				prefs.WriteProfileString(_T("Exporting"), _T("LastFolder"), m_sExportPath);
			}
			else
			{
				prefs.WriteProfileString(_T("Exporting"), _T("LastFolder"), m_sFolderPath);
			}
		}
	}
}
Exemplo n.º 21
0
void sFileDialogControl::CmdStart()
{
  sOpenFileDialog(Text,Extensions,Flags,String,OkMsg,sMessage());
}
Exemplo n.º 22
0
bool ConsoleAdapter::consoleInputBox_KeyUp(const CEGUI::EventArgs& args)
{
    const CEGUI::KeyEventArgs& keyargs = static_cast<const CEGUI::KeyEventArgs&>(args);

    if(keyargs.scancode != CEGUI::Key::Tab)
    {
        mTabPressed = false;
    }
    switch(keyargs.scancode)
    {
    case CEGUI::Key::ArrowUp:
    {
        if(mBackend->getHistory().getHistoryPosition() == 0)
        {
            mCommandLine = mInputBox->getText().c_str();
        }
        else
        {
            // we are not at the command line but in the history
            // => write back the editing
            mBackend->getHistory().changeHistory(mBackend->getHistory().getHistoryPosition(), mInputBox->getText().c_str());
        }
        mBackend->getHistory().moveBackwards();
        if(mBackend->getHistory().getHistoryPosition() != 0)
        {
            mInputBox->setText(mBackend->getHistory().getHistoryString());
        }

        return true;
    }
    case CEGUI::Key::ArrowDown:
    {
        if(mBackend->getHistory().getHistoryPosition() > 0)
        {
            mBackend->getHistory().changeHistory(mBackend->getHistory().getHistoryPosition(), mInputBox->getText().c_str());
            mBackend->getHistory().moveForwards();
            if(mBackend->getHistory().getHistoryPosition() == 0)
            {
                mInputBox->setText(mCommandLine);
            }
            else
            {
                mInputBox->setText(mBackend->getHistory().getHistoryString());
            }
        }

        return true;
    }
    case CEGUI::Key::Tab:
    {
        std::string sCommand(mInputBox->getText().c_str());

        // only process commands
        if(sCommand[0] != '/')
        {
            return true;
        }
        sCommand = sCommand.substr(1, mInputBox->getCaretIndex() - 1);
        if(mTabPressed == true)
        {
            const std::set< std::string > commands(mBackend->getPrefixes(sCommand));

            if(commands.size() > 0)
            {
                std::set< std::string >::const_iterator iCommand(commands.begin());
                std::string sMessage("");

                mSelected = (mSelected + 1) % commands.size();

                int select(0);

                while(iCommand != commands.end())
                {
                    if(select == mSelected)
                    {
                        std::string sCommandLine(mInputBox->getText().c_str());

                        // compose the new command line: old text before the caret + selected command
                        mInputBox->setText(sCommandLine.substr(0, mInputBox->getCaretIndex()) + iCommand->substr(mInputBox->getCaretIndex() - 1));
                        mInputBox->setSelection(mInputBox->getCaretIndex(), 0xFFFFFFFF);
                    }
                    sMessage += *iCommand + ' ';
                    ++iCommand;
                    ++select;
                }
                mBackend->pushMessage(sMessage);
            }
        }
        else
        {
            mTabPressed = true;
            mSelected = 0;

            const std::set< std::string > commands(mBackend->getPrefixes(sCommand));

            if(commands.size() == 0)
            {
                // TODO: Error reporting?
            }
            else
            {
                // if any command starts with the current prefix
                if(commands.size() == 1)
                {
                    mInputBox->setText(std::string("/") + *(commands.begin()) + ' ');
                    // this will be at the end of the text
                    mInputBox->setCaretIndex(0xFFFFFFFF);
                }
                else
                {
                    //If there are multiple matches we need to find the lowest common denominator. We'll do this by iterating through all characters and then checking with all the possible commands if they match that prefix, until we get a false.
                    std::set< std::string >::const_iterator iSelected(commands.begin());
                    std::set< std::string >::const_iterator iCommand(commands.begin());
                    std::string sCommonPrefix(*iCommand);
                    int select = 1;

                    ++iCommand;
                    while(iCommand != commands.end())
                    {
                        if(select == mSelected)
                        {
                            iSelected = iCommand;
                        }

                        std::string::size_type i(0);

                        while((i < sCommonPrefix.length()) && (i < (*iCommand).length()))
                        {
                            if(sCommonPrefix[i] != (*iCommand)[i])
                            {
                                break;
                            }
                            ++i;
                        }
                        if(i < sCommonPrefix.length())
                        {
                            sCommonPrefix = sCommonPrefix.substr(0, i);
                        }
                        ++select;
                        ++iCommand;
                    }
                    mInputBox->setText(std::string("/") + sCommonPrefix + iSelected->substr(sCommonPrefix.length()));
                    mInputBox->setCaretIndex(sCommonPrefix.length() + 1);
                    mInputBox->setSelection(sCommonPrefix.length() + 1, 0xFFFFFFFF);
                }
            }
        }

        return true;
    }
    case CEGUI::Key::Return:
    case CEGUI::Key::NumpadEnter:
    {
        if (mReturnKeyDown) {
            mReturnKeyDown = false;
            if(mInputBox->getSelectionLength() > 0)
            {
                unsigned long ulSelectionEnd(mInputBox->getSelectionEndIndex());

                mInputBox->setText(mInputBox->getText() + ' ');
                mInputBox->setCaretIndex(ulSelectionEnd + 1);
                mInputBox->setSelection(mInputBox->getCaretIndex(), mInputBox->getCaretIndex());
            }
            else
            {
                const CEGUI::String consoleText(mInputBox->getText());

                mInputBox->setText(CEGUI::String(""));
                mBackend->pushMessage(("> " + consoleText).c_str());
                // run the command
                mBackend->runCommand(consoleText.c_str());
                EventCommandExecuted.emit(consoleText.c_str());
            }
        }

        return true;
    }
    default:
    {
        break;
    }
    }

    return false;
}
Exemplo n.º 23
0
void WinFrame::InitWire(const sChar *name)
{
  sWire->AddWindow(name,this);
  sWire->AddParaChoice<WinFrame>(name,L"Default",sMessage(),&WinFrame::Default,L"zero|mixed|extreme");
  sWire->AddKey(name,L"Reset",sMessage(this,&WinFrame::Reset,0));
}
Exemplo n.º 24
0
void WinText::InitWire(const sChar *name)
{
  sWire->AddWindow(name,this);
  sWire->AddKey(name,L"Update",sMessage(this,&WinText::UpdateText));
}
Exemplo n.º 25
0
bool LFSDMSHelper::DeleteDirectoryAndContents(const CStdString& sDirName)
{
	bool bRet		= true;
	BOOL bContinue	= TRUE;
	
	WIN32_FIND_DATA w32Data;
	ZeroMemory(&w32Data, sizeof(w32Data));
	
 	HANDLE hFile = FindFirstFile(sDirName + _T("\\*.*"), &w32Data);
	
	if (hFile == INVALID_HANDLE_VALUE)
	{
		return false;
	}
	
	while (bContinue)
	{
		CStdString sFileName(w32Data.cFileName);
		
 		if ((sFileName == _T(".")) || (sFileName == _T("..")))
		{
			bContinue = FindNextFile(hFile, &w32Data);
			continue;
		}
		
		if (w32Data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
		{
 			if (DeleteDirectoryAndContents(sDirName + _T("\\") + w32Data.cFileName) == false)
			{
				bRet = false;
			}
		}
		else
		{
 			if (DeleteFile(sDirName + _T("\\") + w32Data.cFileName) == false)
			{
				::Sleep(50);
 				if (DeleteFile(sDirName + _T("\\") + w32Data.cFileName) == false)
				{
 					CStdString sMessage(_T("Unable to remove File ") + sDirName + _T("\\") + w32Data.cFileName);
					LOGERROR(HRESULT_FROM_WIN32(GetLastError()), sMessage);
					bRet = false;
				}
			}
		}
		
		bContinue = FindNextFile(hFile, &w32Data);
	}
	
	FindClose(hFile);
	
	if (RemoveDirectory(sDirName) == FALSE)
	{
		::Sleep(50);
		if (RemoveDirectory(sDirName) == FALSE)
		{
 			CStdString sMessage(_T("Unable to remove Directory ") + sDirName + _T("\\") + w32Data.cFileName);
			LOGERROR(HRESULT_FROM_WIN32(GetLastError()), sMessage);
			bRet = false;
		}
	}
	
	return bRet;
}
Exemplo n.º 26
0
MainWindow::MainWindow()
{
  for(sInt i=0;i<sCOUNTOF(ints);i++)
    ints[i] = 0;
  for(sInt i=0;i<sCOUNTOF(floats);i++)
    floats[i] = 0;
  for(sInt i=0;i<sCOUNTOF(strings);i++)
    strings[i] = L"";

  App = this;
  AddChild(sWire = new sWireMasterWindow);

  sWire->AddWindow(L"main",this);
  sWire->AddKey(L"main",L"AddListItem",sMessage(this,&MainWindow::AddListItem));
  sWire->AddKey(L"main",L"Dialog",sMessage(this,&MainWindow::CmdDialog));
  sWire->AddKey(L"main",L"Complicated",sMessage(this,&MainWindow::CmdComplicated));
  sWire->AddChoice(L"main",L"Value",sMessage(),&ints[2],L"Value A|Value B|Value C|Value D|Value E|Value F|Value G");
  sWire->AddChoice(L"main",L"Toggle",sMessage(),&ints[0],L"-|toggle");

  TextWin = new WinText;
  FrameWin = new WinFrame;
  ItemWin = new sGridFrame;

  ListWin = new sMultiListWindow<ListItem>(&Items,sMEMBERPTR(ListItem,Select));
  ListWin->InitWire(L"List");
  ListWin->AddField(L"Name",sLWF_EDIT|sLWF_SORT,150,sMEMBERPTR(ListItem,String));
  ListWin->AddField(L"Value",sLWF_EDIT|sLWF_SORT,50,sMEMBERPTR(ListItem,Value));
  ListWin->AddFieldColor(L"Color",sLWF_SORT,50,sMEMBERPTR(ListItem,Color));
  ListWin->AddFieldChoice(L"Choice",sLWF_EDIT,50,sMEMBERPTR(ListItem,Choice),L"No|Yes|Maybe");
//  ListWin->AddField(L"Const",0,50,&ListItem::ConstString);
  ListWin->AddField(L"Pool",sLWF_EDIT,50,sMEMBERPTR(ListItem,PoolString));
  ListWin->AddHeader();
  ListWin->SelectMsg = sMessage(this,&MainWindow::UpdateItemList);

  TreeWin = new sMultiTreeWindow<ListItem>(&Items,sMEMBERPTR(ListItem,Select3),sMEMBERPTR(ListItem,TreeInfo));
  TreeWin->InitWire(L"Tree");
  TreeWin->AddField(L"Name",sLWF_EDIT,150,sMEMBERPTR(ListItem,String));
  TreeWin->AddField(L"Value",sLWF_EDIT,50,sMEMBERPTR(ListItem,Value));
  TreeWin->AddFieldColor(L"Color",0,50,sMEMBERPTR(ListItem,Color));
  TreeWin->AddFieldChoice(L"Choice",sLWF_EDIT,50,sMEMBERPTR(ListItem,Choice),L"No|Yes|Maybe");
//  TreeWin->AddField(L"Const",0,50,&ListItem::ConstString);
  TreeWin->AddField(L"Pool",sLWF_EDIT,50,sMEMBERPTR(ListItem,PoolString));
  TreeWin->AddHeader();
  TreeWin->SelectMsg = sMessage(this,&MainWindow::UpdateItemTree);

  TextWin->InitWire(L"Text");
  FrameWin->InitWire(L"Frame");
  sWire->AddWindow(L"Item",ItemWin);
  sWire->ProcessFile(L"forms.wire.txt");
  sWire->ProcessEnd();

  TextWin->UpdateText(0);

  sRandom rnd;
  for(sInt i=0;i<15;i++)
  {
    ListItem *li = new ListItem();
    sInt jmax = rnd.Int(3)+3;
    for(sInt j=0;j<jmax;j++)
      li->String[j] = rnd.Int('z'-'a')+'a';
    li->String[jmax] = 0;
    li->TreeInfo.Level = rnd.Int(5);
    Items.AddTail(li);
  }
  TreeWin->UpdateTreeInfo();
//  Items.AddTail(new ListItem(L"bli",23,0xffffff));
//  Items.AddTail(new ListItem(L"bla",42,0xff00ff));
//  Items.AddTail(new ListItem(L"blub",64,0x0000ff));
//  ListWin->UpdateList();
  ListWin->Update();
  TreeWin->Update();
}