Пример #1
0
void CGameGUIFileDialog::ProcessSelect()
{
	std::string sFile=m_sFile;
	if(m_piEDPath){sFile=m_piEDPath->GetText();}
	
	if(FileIsDirectory(sFile.c_str()))
	{
	  UpdateFiles();
	  return;
	}
	
	if(m_bOpenMode)
	{
	  if(!FileExists(sFile.c_str()))
	  {
		MessageDialog((std::string)"The file '"+sFile+"' does not exist.","Error",eMessageDialogType_Error);
		if(m_piEDPath){m_piGUIManager->SetFocus(m_piEDPath);}
		return;
	  }
	}
	else
	{
	  if(FileExists(sFile.c_str()) && m_bOverWriteWarn)
	  {
		if(ConfirmDialog((std::string)"Overwrite '"+sFile+"' ?.","Warning!",eMessageDialogType_Warning)!=DIALOG_OK)
		{
		  if(m_piEDPath){m_piGUIManager->SetFocus(m_piEDPath);}
		  return;
		}
	  }
	}
	m_sFile=sFile;
	EndDialog(DIALOG_OK);
}
Пример #2
0
void wxFileCtrl::ChangeToReportMode()
{
    ClearAll();
    SetSingleStyle( wxLC_REPORT );

    // do this since WIN32 does mm/dd/yy UNIX does mm/dd/yyyy
    // don't hardcode since mm/dd is dd/mm elsewhere
    int w, h;
    wxDateTime dt(22, wxDateTime::Dec, 2002, 22, 22, 22);
    wxString txt = dt.FormatDate() + wxT("22") + dt.Format(wxT("%I:%M:%S %p"));
    GetTextExtent(txt, &w, &h);

    InsertColumn( 0, _("Name"), wxLIST_FORMAT_LEFT, w );
    InsertColumn( 1, _("Size"), wxLIST_FORMAT_LEFT, w/2 );
    InsertColumn( 2, _("Type"), wxLIST_FORMAT_LEFT, w/2 );
    InsertColumn( 3, _("Modified"), wxLIST_FORMAT_LEFT, w );
#if defined(__UNIX__)
    GetTextExtent(wxT("Permissions 2"), &w, &h);
    InsertColumn( 4, _("Permissions"), wxLIST_FORMAT_LEFT, w );
#elif defined(__WIN32__)
    GetTextExtent(wxT("Attributes 2"), &w, &h);
    InsertColumn( 4, _("Attributes"), wxLIST_FORMAT_LEFT, w );
#endif

    UpdateFiles();
}
Пример #3
0
void wxFileCtrl::GoToParentDir()
{
    if (!IsTopMostDir(m_dirName))
    {
        size_t len = m_dirName.Len();
        if (wxEndsWithPathSeparator(m_dirName))
            m_dirName.Remove( len-1, 1 );
        wxString fname( wxFileNameFromPath(m_dirName) );
        m_dirName = wxPathOnly( m_dirName );
#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
        if (!m_dirName.empty())
        {
            if (m_dirName.Last() == wxT('.'))
                m_dirName = wxEmptyString;
        }
#elif defined(__UNIX__)
        if (m_dirName.empty())
            m_dirName = wxT("/");
#endif
        UpdateFiles();
        long id = FindItem( 0, fname );
        if (id != wxNOT_FOUND)
        {
            ignoreChanges = true;
            SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
            EnsureVisible( id );
            ignoreChanges = false;
        }
    }
}
Пример #4
0
// Reads and parses the file
// and returns the created Book
QSharedPointer<Book> ImportHTML::GetBook()
{
    QString source = LoadSource();
    LoadMetadata(source);
    UpdateFiles(CreateHTMLResource(), source, LoadFolderStructure(source));
    return m_Book;
}
Пример #5
0
void wxFileCtrl::SetWild( const wxString &wild )
{
    if (wild.Find(wxT('|')) != wxNOT_FOUND)
        return;

    m_wild = wild;
    UpdateFiles();
}
Пример #6
0
	void TorrentFilesModel::update ()
	{
		const auto& handle = Core::Instance ()->GetTorrentHandle (Index_);
		const auto& base = Core::Instance ()->GetStatusKeeper ()->
				GetStatus (handle, libtorrent::torrent_handle::query_save_path).save_path;

		const auto& files = Core::Instance ()->GetTorrentFiles (Index_);
		UpdateFiles (base, files);
	}
Пример #7
0
void wxFileListCtrl::GoToDir( const wxString &dir )
{
    if (!wxDirExists(dir)) return;

    m_dirName = dir;
    UpdateFiles();

    SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );

    EnsureVisible( 0 );
}
Пример #8
0
/**
 * \brief Load options and settings from Registry.
 */
void COptions::Load()
{
    m_Backup = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("Backup"), 1);
    m_AutoCompleteValues = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("AutoCompleteValues"), 1);
    m_OpenLastFile = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("OpenLastFile"), 0);
    m_GridLines = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("GridLines"), 0);
    m_ReplaceSpecialChar = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ReplaceSpecialChar"), 1);
    m_ScrollToSelected = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ScrollToSelected"), 1);
    m_DisableSave = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("DisableSave"), 0);

    // Files
    m_ConfigDir = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("ConfigDir"), GetAppPath());
    UpdateFiles();
    ((CBibedtApp*)AfxGetApp())->m_Language.SetCurLang(AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Language"), _T("")));
    // Fonts
    m_FontProp = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Font.Prop"), _T("Times New Roman"));
    m_FontMono = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Font.Mono"), _T("Courier New"));
    m_FontSans = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Font.Sans"), _T("MS Sans Serif"));

    m_TranslateASCII = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("TranslateASCII"), 1);
    m_SortCaseSensitive = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("CaseSensSort"), 0);
    m_SortOnSave = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("SortOnSave"), 0);
    m_LineLength = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("LineLength"), MAX_LINE);
    m_CiteFormat = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("CiteFormat"), _T("\\cite{%s}"));
    m_ShowCiteDlg = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ShowCiteDlg"), 1);
    m_DOIURL = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("DOIURL"), DEF_DOI_URL);
    if (!m_DOIURL.IsEmpty()) {
        if (m_DOIURL.Left(7).CompareNoCase(_T("http://")) != 0)
            m_DOIURL = _T("http://") + m_DOIURL;
        if (m_DOIURL.Right(1).Compare(_T("/")) != 0)
            m_DOIURL += _T("/");
    } else
        m_DOIURL = DEF_DOI_URL;
    m_EditorClassName = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("EditorClass"), _T(""));
    m_EditorParentClass = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("EditorParentClass"), _T(""));

    // Print
    m_MarginLeft = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginLeft"), MARGIN_LEFT);
    m_MarginTop = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginTop"), MARGIN_TOP);
    m_MarginRight = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginRight"), MARGIN_RIGHT);
    m_MarginBottom = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginBottom"), MARGIN_BOTTOM);
    m_PrintUnits = (enum Units)AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("PrintUnits"), 0);

    // Columns
    m_ColCount = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ColCount"), 3);

    // Quicksearch
    m_QuickSearchFields = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("QuickSearchFields"), _T("author;title;"));

    // Window placement
    ReadWindowPlacement(_T(""),	&m_WindowPlacement);
}
Пример #9
0
void wxFileCtrl::GoToDir( const wxString &dir )
{
    if (!wxDirExists(dir)) return;

    m_dirName = dir;
    UpdateFiles();

    ignoreChanges = true;
    SetItemState( 0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
    ignoreChanges = false;

    EnsureVisible( 0 );
}
Пример #10
0
void CGameGUIFileDialog::OnInitDialog()
{
	CGameDialogBase::OnInitDialog();
	if(m_sFile==""){m_sFile=AppendPathSeparator(GetWorkingFolder());}
	if(m_piSTTitle){m_piSTTitle->SetText(m_sTitle);}
	if(m_piEDPath)
	{
		m_piEDPath->SetText(m_sFile);
		m_piEDPath->SetCursor(m_sFile.length());
		m_piGUIManager->SetFocus(m_piEDPath);
	}
	UpdateFiles();
}
Пример #11
0
// Reads and parses the file
// and returns the created Book
QSharedPointer<Book> ImportHTML::GetBook(bool extract_metadata)
{
    QString source = LoadSource();
    if (extract_metadata) {
        LoadMetadata(source);
    }
    UpdateFiles(CreateHTMLResource(), source, LoadFolderStructure(source));

    // Before returning the new book, if it is epub3, make sure it has a nav
    if (m_EpubVersion.startsWith('3')) {
        HTMLResource* nav_resource = m_Book->GetConstOPF()->GetNavResource();
        if (!nav_resource) {
            HTMLResource * nav_resource = m_Book->CreateEmptyNavFile(true);
            m_Book->GetOPF()->SetNavResource(nav_resource);
            m_Book->GetOPF()->SetItemRefLinear(nav_resource, false);
        }
    }
    return m_Book;
}
Пример #12
0
void CGameGUIFileDialog::AutoComplete()
{
	std::string sFile;
	if(m_piEDPath){sFile=m_piEDPath->GetText();}
	
	std::string sFilter=sFile+"*";
	std::set<std::string> sCandidateFiles;
	std::set<std::string> sFiles;
	std::set<std::string>::iterator i;
	FindFiles(sFilter.c_str(),eFindFilesMode_DirsAndFiles,&sFiles);
	for(i=sFiles.begin();i!=sFiles.end();i++)
	{
	  const char *pEditFile=sFile.c_str();
	  const char *pListFile=i->c_str();
	  if(strncmp(pListFile,pEditFile,sFile.length())!=0){continue;}
	  sCandidateFiles.insert(*i);
	}
	if(sCandidateFiles.size())
	{
	  while(true)
	  {
		int nPos=sFile.length();
		bool bFinished=true;
		unsigned char nChar=sCandidateFiles.begin()->c_str()[nPos];
		if(nChar==0){break;}
		for(i=sCandidateFiles.begin();i!=sCandidateFiles.end();i++)
		{
		  if(i->c_str()[nPos]!=nChar){bFinished=false;break;}
		}
		if(!bFinished){break;}
		sFile+=nChar;
	  }
	}
	if(m_piEDPath)
	{
	  std::string sNormalized=NormalizePath(sFile);
	  m_piEDPath->SetText(sNormalized);
	  m_piEDPath->SetCursor(sNormalized.length());
	  
	  UpdateFiles();
	}
}
Пример #13
0
void CGameGUIFileDialog::OnTextChanged(IGameGUIEdit *piControl,std::string sNewText)
{
  UpdateFiles();
}
Пример #14
0
void wxFileCtrl::ShowHidden( bool show )
{
    m_showHidden = show;
    UpdateFiles();
}
Пример #15
0
void wxFileCtrl::ChangeToSmallIconMode()
{
    ClearAll();
    SetSingleStyle( wxLC_SMALL_ICON );
    UpdateFiles();
}
Пример #16
0
void wxFileCtrl::ChangeToListMode()
{
    ClearAll();
    SetSingleStyle( wxLC_LIST );
    UpdateFiles();
}
Пример #17
0
/*
 * EditMain - main driver for editor (command mode)
 */
void EditMain( void )
{
    vi_rc       rc;
    char        *msg = NULL;
    bool        doclear;

    /*
     * loop forever, or at least until all done
     */
    for( ;; ) {

#if 0
#ifdef __WIN__
        PushMode();
        UpdateFiles();
        PopMode();
#endif
#endif
        if( !EditFlags.InsertModeActive || EditFlags.Modeless ) {
            if( EditFlags.Modeless ) {
                UpdateEditStatus();
                EditFlags.NoCapsLock = false;
            } else {
                UpdateCurrentStatus( CSTATUS_COMMAND );
                EditFlags.NoCapsLock = true;
            }

            if( !EditFlags.Modeless && EditFlags.ReturnToInsertMode &&
                                !NonKeyboardEventsPending() ) {
                EditFlags.ReturnToInsertMode = false;
                if( EditFlags.WasOverstrike ) {
                    LastEvent = 'R';
                } else {
                    LastEvent = 'i';
                }
            } else {
                DCUpdateAll();
#ifdef __WIN__
                SetWindowCursorForReal();
#endif
                LastEvent = GetNextEvent( true );
            }
            EditFlags.NoCapsLock = false;
            doclear = true;
            if( LastEvent == VI_KEY( MOUSEEVENT ) ) {
                if( LastMouseEvent == MOUSE_MOVE ) {
                    doclear = false;
                }
            }
            if( doclear ) {
                if( EditFlags.AutoMessageClear ) {
                    ClearWindow( MessageWindow );
                }
#ifndef __WIN__
                ResetDisplayLine();
#endif
            }
        } else {
            // Cannot do a RestoreInfo while we are in insert mode
            // because it will call ValidateCurrentColumn which will
            // do something stupid on us... PushMode/PopMode solution
            // not working yet... this needs a little work
            DCUpdate();
#ifdef __WIN__
            SetWindowCursorForReal();
#endif
            LastEvent = GetNextEvent( true );
        }

        rc = DoLastEvent();

        if( EditFlags.ReadOnlyError && rc <= ERR_NO_ERR ) {
            EditFlags.ReadOnlyError = false;
            rc = ERR_READ_ONLY_FILE_MODIFIED;
        }
        if( rc > ERR_NO_ERR ) {
            msg = GetErrorMsg( rc );
        }

        DoneLastEvent( rc, false );

        if( rc > ERR_NO_ERR ) {
            Error( msg );
        }

    }

} /* EditMain */