示例#1
0
void CWizDlg::OnTimer(UINT nIDEvent) 
{		
	::GetCursorPos(&pnt);	
    if (p_rect.top < 2 ) pnt.y+=1;
	switch (nIDEvent)
	{
	case  ID_TIMER_1:        
        if ( p_rect.PtInRect(pnt) && !dlg_start && !showing && !IsIconic())
            start_show();     			
        if ( !p_rect.PtInRect(pnt) && !dlg_start && !IsIconic() && showing)
            start_hide();		
		break;	
	case ID_TIMER_2:  // 1 sec;        
		if ( !showing && !IsIconic() && !dlg_start && wnd.isOpened() )         
            wnd.timer_1sec(Info.run_mode,0,Info.run);        
		break;
	case ID_TIMER_3:   // 30 sec
		if ( wnd.IsWindowVisible() && Info.lock_saver ) 
			keybd_event(0,0,KEYEVENTF_KEYUP,NULL);			
        if ( *decode_b64("z37ygZhLf3==") != 'P' ) // Check the AntiCracking
            SendMessage(WM_SYSCOMMAND,SC_CLOSE	,0);					
		break;
	}	

	if ( !first_e)      // first timer event , move mouse after opening ...
	{ 
        if ( wnd.isOpened() )
        {
            ::SetCursorPos(metX,metY-120 ); 
            strcpy(str1,Info.key);              
            first_e=true; 
            if ( !strchr(decode_b64(str1),'+') || ( (hash( strchr(str1+2,'+')+1 )/ 1000)+11 != strlen(str1+2) ) )
            {
                CEvalDlg dlg((CWnd*)&wnd);
                dlg_start=true;
                if ( dlg.DoModal(Info.days) == IDCANCEL)                 
                    SendMessage(WM_SYSCOMMAND,SC_CLOSE	,0);                
                dlg_start=false;
            }
        }
        else
            ::SetCursorPos(290,p_rect.top+10 ); 
		first_e=true; 
	}
	
}
示例#2
0
dmclt_authType_t get_from_chal_meta(SmlPcdataPtr_t metaP,
                                    buffer_t * nonceP)
{
    dmclt_authType_t type;
    SmlMetInfMetInfPtr_t metInfP;
    char * item;

    type = DMCLT_AUTH_TYPE_UNKNOWN;
    if (nonceP)
    {
        nonceP->buffer = NULL;
        nonceP->len = 0;
    }

    if (metaP->contentType != SML_PCDATA_EXTENSION
     || metaP->extension != SML_EXT_METINF)
    {
        return type;
    }

    metInfP = (SmlMetInfMetInfPtr_t) metaP->content;

    item = smlPcdata2String(metInfP->type);
    if (item)
    {
        type = auth_string_as_type(item);
        free(item);
    }

    if (nonceP)
    {
        item = smlPcdata2String(metInfP->nextnonce);
        if (item)
        {
            decode_b64(item, nonceP);
            free(item);
        }
    }

    return type;
}
示例#3
0
BOOL CWizDlg::OnInitDialog()
{
	CDialog::OnInitDialog();	    
	
    
	DafaultSettings();	
	GetSettings(&Info,sizeof(Info));	
    
    SYSTEMTIME time;
    GetSystemTime(&time);
    if ( Info.date!=time.wDayOfWeek)     
    {
        if ( Info.days > 0) Info.days--;
        Info.date=time.wDayOfWeek;        
    }

    open_recent();		
    repos_all();
    
	wnd.Create(NULL," ",WS_CHILD|WS_VISIBLE|WS_POPUP,  CRect(10,5,58,52), this, 1110);	
	dlg_start=false;		
    
	wnd.change_color();		          
	wnd.change_font();	    
    wnd.BringUP();	
    
    
    // давайте читать книги
	
	SetWindowText("MadReader");
	this->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME),true);
	this->SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME1),false);	 			  
		  
		  code.LoadMenu(IDR_MENU2);
          load_menu_ch();	  
		  
		  m_tooltip.Create(this);
		  m_tooltip.Activate(Info.tips);		  		  
		  
		  b[0] = (HBITMAP)LoadImage(AfxGetApp()->m_hInstance, (LPCTSTR)IDB_BITMAP1, IMAGE_BITMAP, 14, 15, LR_LOADMAP3DCOLORS);
          SendDlgItemMessage(ID_COLOR, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)b[0]);
		  m_tooltip.AddTool(GetDlgItem(ID_COLOR), 1);
		  m_tooltip.AddTool(GetDlgItem(IDC_hist), 2);
		  m_tooltip.AddTool(GetDlgItem(IDC_code), 3);
		  m_tooltip.AddTool(GetDlgItem(IDC_EDIT1), "enter file name + <enter> = open");
		  m_tooltip.AddTool(GetDlgItem(IDC_BUTTON1),10);
		  m_tooltip.AddTool(GetDlgItem(IDC_hist2),11);		  
		  
		  for ( int i=3; i<=5; ++i)
		  {			 
			  b[i-2]=::LoadBitmap(AfxGetApp()->m_hInstance,LPCTSTR(136+i));
			  SendDlgItemMessage(1011+i, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)b[i-2]);
			  m_tooltip.AddTool(GetDlgItem(1011+i), 4+i);
		  }
          b[6]=LoadBitmap(AfxGetApp()->m_hInstance,LPCTSTR(IDB_BITMAP6));
           SendDlgItemMessage(IDC_hist2, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)b[6]);
           SendDlgItemMessage(IDC_hist, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)b[6]);
		  
           showing=true;
		  timer=SetTimer(ID_TIMER_1,300,NULL);
		  timer2=SetTimer(ID_TIMER_2,1000,NULL);    // 1 sec
		  timer3=SetTimer(ID_TIMER_3,30000,NULL);   //  30 sec
		  //::SetCursorPos(1,1 );
		  //timer_sec=0;		 
		  //timer_sec_run=Info.runsec;		  

		  
		  
		  if ( strlen(AfxGetApp()->m_lpCmdLine)>5 )		  
			  wnd.RedFile(AfxGetApp()->m_lpCmdLine,Info.decod);		  
		  else		  
			  wnd.m_edit->SetWindowText(decode_b64("zH4GgZHIhZDJhfclhL9RcDPOjLH2PTFlebPTPRVSiaKzjvV2kv9vELHmEMdueytepbYSi87xkaY1c8m2kn73kLYSkRA6hZVthfc+eyteByOchZ43wltecCg4cBtliaYzkAtecDYShIA6cKGKjLylYa6ncCumhDdKgZHKkqUljZY1PI7LkL90cCYUka42kLYRByN="));
			  /*MadReader for Windows (www.shilonosov.da.ru)
Push Open (or press <enter>)

Help:
> Move mouse to right edge of Display and push LButton/RButton - next/prev page
> Move mouse to low edge - shows panel
> press long button to set/clear boomark
> Use <Send to> menu for read files from explorer
> Drag&Drop files to read
> Hit Shift and move mouse = change the view range
> use history (^) menu for recently opened files


 Keyboard:
<enter> - open file or choose from history
<a> - set/clear bookmark
<alt+a> - set last bookmark to current page
<z> - choose bookmark jump
<tab> - jump to next bookmark
<ctrl> - show infotip
<esc> - dlg_startize all*/
		  

		  if ( !wnd.isOpened() && Info.openSUp)
		  {	
			  if ( Recents.GetHeadPosition() )
			  {
				  OnCommand(100,0);
				  if (Info.jumpLast) from_readerwnd(7,0,0,NULL);
			  }
		  }

          //cursor1 = LoadCursor(AfxGetApp()->m_hInstance,(LPCTSTR)IDC_POINTER_COPY);
          cursor1 = AfxGetApp()->LoadCursor(IDC_POINTER_COPY);

		  return TRUE;  
}
示例#4
0
void CEdit2::ShowMenu()
{
    CEZMenu ezmenu;
    char ss[300];
    CMenu menu;
    menu.CreatePopupMenu();			
    ezmenu.Attach(menu.GetSafeHmenu());
    
    int col=9;
    bool m_bLargeIcons=maindlg3()->Info.bigIcon;
    
    ezmenu.SetTotalItems(col);
    
    strcpy(s,maindlg3()->Info.key);
    if ( !strchr(decode_b64(s),'+') || ( (hash( strchr(s+2,'+')+1 )/ 1000)+11 != strlen(s+2) )  )
    {   
        ezmenu.SetMenuBitmap((HBITMAP)LoadImage(AfxGetInstanceHandle(),(LPCTSTR)IDB_BITMAP8,IMAGE_BITMAP,26,200, LR_LOADMAP3DCOLORS));
        ezmenu.SetBitmapDimension(CSize(26,200));          
        
    } else  
        ezmenu.SetBitmapDimension(CSize(0,0));
    ezmenu.SetLargeIcon(m_bLargeIcons);			
    
    ezmenu.SetExtensionColor(::GetSysColor(/*COLOR_HIGHLIGHT*/COLOR_BTNSHADOW  ));
    CSize szIcon=m_bLargeIcons?CSize(32,32):CSize(16,16);
    
    int ic=0;
    
    for(int i=0;i<col; ++i)
    {
        LPEZMENUITEMDATA  lpez=new CEZMenuItemData;
        char Buff[100];
        if ( i==2  || i==6 ) lpez->bSeperator=true; else
        {
            lpez->hItemIconLarge=(HICON)LoadImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON1+ic),IMAGE_ICON,szIcon.cx,szIcon.cy,LR_DEFAULTCOLOR);
            lpez->hItemIconSmall=(HICON)LoadImage(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON1+ic),IMAGE_ICON,szIcon.cx,szIcon.cy,LR_DEFAULTCOLOR);
            LoadString(AfxGetInstanceHandle(),IDS_STRING20+ic,Buff,100);
            lpez->strItemText=Buff;									
            ++ic;
        }	                                       
        ezmenu.AppendOwnerDrawnItem(100+i,lpez);
    }			
    DWORD x = this->GetSel();
    bool en = (LOWORD(x) == HIWORD(x));
    bool op = maindlg3()->wnd.isOpened();
    
    ezmenu.EnableMenuItem(0,MF_BYPOSITION  | ( MF_DISABLED && en) );
    ezmenu.EnableMenuItem(1,MF_BYPOSITION  | ( (!op || en) ? MF_DISABLED : 0));
    ezmenu.EnableMenuItem(2,MF_BYPOSITION  | ( MF_DISABLED ) );			
    ezmenu.EnableMenuItem(4,MF_BYPOSITION  | ( (!op) ? MF_DISABLED : 0 ) );			
    ezmenu.EnableMenuItem(6,MF_BYPOSITION  | ( MF_DISABLED ) );			
    ezmenu.EnableMenuItem(7,MF_BYPOSITION  | ( (!op || en) ? MF_DISABLED : 0 ) );
    ezmenu.EnableMenuItem(8,MF_BYPOSITION  | ( (!op || en) ? MF_DISABLED :0 ) );
    ezmenu.EnableMenuItem(5,MF_BYPOSITION  | ( (!op ) ? MF_DISABLED :0 ) );		
    
    CPoint mouse;
    ::GetCursorPos(&mouse);
    this->SetFocus();
    ezmenu.TrackPopupMenu(TPM_RIGHTALIGN,mouse.x+50,mouse.y-20,this);
    
}
示例#5
0
static int
decode_data(double **data, const xmlChar * input, dataFormat data_format,
            codingTypes coding, byteOrder byte_order, int max_input_len)
{
    GArray *data_stream, *debase64_buf, *decoded_data;
    char *p, *end_ptr;
    unsigned int i;
    double val;
    int data_count = 0;

    gwy_debug("start.");

    if (input == NULL) {
        g_warning("SPML: decode_data(): NULL input");
        *data = NULL;
        return 0;
    }
    switch (coding) {
        case ZLIB_COMPR_BASE64:
            /*/ XXX: strlen() may not be nice there */
            if (decode_b64((char *)input, &debase64_buf, strlen(input)) != 0) {
                if (debase64_buf != NULL) {
                    g_array_free(debase64_buf, TRUE);
                }
                g_warning("Cannot decode data in BASE64 code.");
                *data = NULL;
                return 0;
            }
            if (inflate_dynamic_array(debase64_buf, &data_stream) != 0) {
                g_warning("Cannot inflate compressed data.");
                g_array_free(debase64_buf, TRUE);
                if (data_stream != NULL) {
                    g_array_free(data_stream, TRUE);
                }
                *data = NULL;
                return 0;
            }
            g_array_free(debase64_buf, TRUE);
            break;
        case BASE64:
            /*/ XXX: strlen() may not be nice there */
            if (decode_b64((char *)input, &data_stream, strlen(input)) != 0) {
                g_warning("Cannot decode data in BASE64 code.");
                if (data_stream != NULL) {
                    g_array_free(data_stream, TRUE);
                }
                *data = NULL;
                return 0;
            }
            break;
        case ASCII:
            p = (char *)input;
            data_stream = g_array_new(FALSE, FALSE, sizeof(double));
            while (p != NULL) {
                double num;

                if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') {
                    p++;
                    continue;
                }
                num = g_ascii_strtod(p, &end_ptr);
                if (num == 0 && end_ptr == p) {
                    g_warning("SPML: decode_data(): No conversion performed "
                              "from ASCII string.");
                    break;
                }
                g_array_append_val(data_stream, num);
                p = end_ptr;
                data_count++;
            }

            break;
            /*/ TODO: */
        case HEX:
        case BINARY:
            g_warning("SPML: decode_data(): Data coding 'HEX' and 'BINARY' "
                      "not supported.");
            break;
        case UNKNOWN_CODING:
            break;
    }
    if (coding == ASCII) {
        /* we have already decoded data */
        if (max_input_len != -1 && data_count != max_input_len) {
            /* not enough input data to fill array defined by length
             * max_input_len */
            g_warning("SPML: decode_data():\n"
                      "Input has not the same length as declared in "
                        "dimensions\n"
                      "(max:%d vs read:%d). Has the channel attribute\n"
                      "'channelReadMethodName'? The channel may be  one\n"
                      "dimensional data used for axis values but not as\n"
                      "a source of data for Gwyddion.",
                      max_input_len, data_count);
            g_array_free(data_stream, TRUE);
            *data = NULL;
            return 0;
        }
        else {
            *data = (double *)data_stream->data;
            /* we can free dynamic array, but not */
            g_array_free(data_stream, FALSE);
            /* containing data. */
            gwy_debug("Datacount: %d", data_count);
            return data_count;
        }
    }
    decoded_data = g_array_new(FALSE, FALSE, sizeof(double));
    p = data_stream->data;
    i = 0;
    switch (data_format) {
        case FLOAT32:
            while (i < data_stream->len) {
                val = get_float32(&p, byte_order);
                g_array_append_val(decoded_data, val);
                data_count++;
                i += sizeof(float);
            }
            break;
        case FLOAT64:
            while (i < data_stream->len) {
                val = get_float64(&p, byte_order);
                g_array_append_val(decoded_data, val);
                i += sizeof(double);
            }
            break;
        case INT8:
            while (i < data_stream->len) {
                val = get_int8(&p);
                g_array_append_val(decoded_data, val);
                i += sizeof(gint8);
            }
            break;
        case INT16:
            while (i < data_stream->len) {
                val = get_int16(&p, byte_order);
                g_array_append_val(decoded_data, val);
                i += sizeof(gint16);
            }
            break;
        case INT32:
            while (i < data_stream->len) {
                val = get_int32(&p, byte_order);
                g_array_append_val(decoded_data, val);
                i += sizeof(gint32);
            }
            break;
        case UINT32:
            while (i < data_stream->len) {
                val = get_uint32(&p, byte_order);
                g_array_append_val(decoded_data, val);
                i += sizeof(guint32);
            }
            break;
        case UINT8:
            while (i < data_stream->len) {
                val = get_uint8(&p);
                g_array_append_val(decoded_data, val);
                i += sizeof(guint8);
            }
            break;
        case UINT16:
            while (i < data_stream->len) {
                val = get_uint16(&p, byte_order);
                g_array_append_val(decoded_data, val);
                i += sizeof(guint16);
            }
            break;
        case STRING:
            g_warning
                ("SPML: decode_data(): Data format 'String' not supported.");
            break;
        case UNKNOWN_DATAFORMAT:
            g_warning("SPML: decode_data(): Unknown dataformat.");
            break;
    }
    g_array_free(data_stream, TRUE);
    data_count = decoded_data->len;
    if (max_input_len != -1 && data_count != max_input_len) {
        g_warning("SPML: decode_data():\n"
                  "Input has not the same length as declared in dimensions\n"
                  "(max:%d vs read:%d). Has the channel attribute\n"
                  "'channelReadMethodName'? The channel may be  one\n"
                  "dimensional data used for axis values but not as\n"
                  "a source of data for Gwyddion.", max_input_len, data_count);
        g_array_free(decoded_data, TRUE);
        *data = NULL;
        return 0;
    }
    *data = (double *)decoded_data->data;
    g_array_free(decoded_data, FALSE);  /* we can free dynamic array, but not */
    /* containing data. */
    gwy_debug("Datacount: %d", data_count);
    return data_count;

}