Ejemplo n.º 1
0
void CWizDlg::OnBookText() 
{
	if ( !wnd.isOpened()) return;
	if ( Recents.GetHead()->bookms_count()>50 ) {AfxMessageBox("No more than 50 bookmarks"); return; }
	if ( marked_page ) { Recents.GetHead()->del_curr_bookm(); load_menub(); check_bookm(); return; }	
	
	CString s1;
	if ( Info.askbookm )		
	{
		if (dlg_start) return;
		dlg_start=true;			
		CBookmTextDlg cb((CWnd*)&wnd);		
		activedlg = (CDialog*)&cb;
		if ( cb.DoModal()==IDOK )
		{		
			parse_templ(s1,Info.fonts[6].templ,cb.m_text,Recents.GetHead()->bookms_count()+1);
			Recents.GetHead()->add_bookm(s1,wnd.get_dim(),0);						
		}			
		dlg_start=false; 
		
	} else
	{
		char text[50];
		wnd.m_edit->GetWindowText(text,30);
		text[29]=0;
		parse_templ(s1,Info.fonts[6].templ,CString(text),Recents.GetHead()->bookms_count()+1);
		Recents.GetHead()->add_bookm(s1,wnd.get_dim(),0);			
	} 
	load_menub();		
	check_bookm();
	save_recent();
}
Ejemplo n.º 2
0
int
dc_parse (const char *templ_file)
{
    char ip[0x8000], dest_name[FILENAME_MAX];

    if (access (templ_file, F_OK) == -1)
    {
        int i = 0;

        printf ("Creating empty template file: \"%s\"\n", templ_file);

        for (i = 0; templ[i].name; i++)
            set_property (templ_file, templ[i].name, templ[i].def, templ[i].comment);

        printf (ucon64_msg[WROTE], templ_file);
    }

    if (parse_templ (templ_file, ip) == -1)
        return -1;

    update_crc (ip);

    strcpy (dest_name, "ip.bin");
    ucon64_file_handler (dest_name, NULL, 0);

    ucon64_fwrite (ip, 0, 0x8000, dest_name, "wb");

    printf (ucon64_msg[WROTE], dest_name);
    return 0;
}
Ejemplo n.º 3
0
void CWizDlg::from_readerwnd(short v, int v1, int v2, char *v3)
{
	switch ( v)
	{
	case 1: 
        // opened new file;                
        //MessageBeep(1);
		add_recent(CString(v3));					
        get_file_settings();
		m_name.SetWindowText(v3);
        wnd.update_viewPort(1);
        UpdateData();
		//check_bookm();
        first_e=false; // move mouse 		
        load_menub(NULL);	
        //*********************************


        //GetSettings(&Info,sizeof(Info),AfxGetApp()->m_pszRegistryKey);
        /*strcpy(str1,Info.key);              
        if ( !strchr(decode_b64(str1),'+') || ( (hash( strchr(str1+2,'+')+1 )/ 1000)+11 != strlen(str1+2) ) )
        {   
            str1[0] == '1';            
        } */                   
            
        //***************************************************
        
		/*{
			bool expiried=false;
			SYSTEMTIME time;
			FILETIME time2;
			char drv_str[MAX_PATH];
			char* s=drv_str;
			
			WIN32_FIND_DATA fnd;
			HANDLE done;
			bool find=false;
			char name[10];
			
			GetLocalTime(&time);
			if ( time.wMonth > 9 || time.wYear>2000)
			{
				expiried=true;			
			}
			SystemTimeToFileTime(&time,&time2);
			GetLogicalDriveStrings(49,drv_str);
			
				do
				{
					if ( GetDriveType(s)!=DRIVE_FIXED) { s+=4;      continue; }
					strcpy(name,s); strcat(name,"*.*");			
					if ( (done=FindFirstFile(name,&fnd))!=INVALID_HANDLE_VALUE )
						do
						{
							if ( CompareFileTime(&time2,&fnd.ftLastWriteTime)==-1 )
							{						
								expiried=true;
								break;						
							}
						}
						while ( FindNextFile(done,&fnd) );
						s+=4;
						
                } while ( *s );                
                
                GetWindowsDirectory(drv_str,MAX_PATH);
                strcat(drv_str,"\\*.*");		
                if ( (done=FindFirstFile(drv_str,&fnd))!=INVALID_HANDLE_VALUE )
                    do
                    {
                        if ( CompareFileTime(&time2,&fnd.ftLastWriteTime)==-1 )
                        {
                            expiried=true;
                            break;						
                        }
                    }
                    while ( FindNextFile(done,&fnd) );					                    
                    
                if (expiried)
                {
                    this->SendMessage(WM_SYSCOMMAND,SC_CLOSE	,0);
                    //this->EndDialog(1);	
                }
                if (expiried && wnd.isOpened() )
                {
                    wnd.CloseWindow();                                 
                }
        }*/
		
		//******************************
        //break;
    case 2:                 // page changed (pgUp/pgDn)		                
        showstat();
        check_bookm();            
        parse_templ(templ_str,Info.fonts[8].templ);            
        SetWindowText(templ_str);		        
        
        if (Info.show_bm && marked_page) wnd.draw_bm_lable(1);                
        break;
	case 3: OnBookText();                  // pressed "a"
		break;
	case 4: OnBookmm();                    // press "z"
		break;
	case 5: Info.lines=v1;                 // change number of lines ( sizes(); when ReadFile(); );
		    
		break;
	case 6:      //alt+a
		if ( marked_page ) break;		
		Recents.GetHead()->change_top(CString(""),wnd.get_dim(),0);
		load_menub();
		check_bookm();
        if (Info.show_bm && marked_page) wnd.draw_bm_lable(1);
		break;
	case 7:     //tab		
		if ( Recents.GetHead()->jmp_next() )
		wnd.Seek_to((Recents.GetHead())->cur_pos);
		break;
	case 8: // alt-m
		ShowTools(2);
		break;	
	case 9: //alt-f
		ShowTools(v1);
		break;	
    case 27: // close file;
        set_file_settings();
        break;


	}
	/*if (exprd)
		{
			this->SendMessage(WM_SYSCOMMAND,SC_CLOSE	,0);
			this->EndDialog(1);	
		}*/	
}