示例#1
0
int TMain::CheckPing() {
	int Result = ID_NO;
	String Host, Phone, S = "";

	ShowWaitCursor();

	TFileIni* FileIni = CreateINIFile();

	for (int i = 1; i <= FileIni->ReadInteger("DB", "Count", 0); i++) {
		ProcMess();

		Host = FileIni->ReadString("DB", "Ping" + IntToStr(i), "");

		if (Host != "")
			if (!Ping(Host))
				S = ConcatStrings(S, Format(IDS_PING_ERROR,
				ARRAYOFCONST((FileIni->ReadString("DB", "Name" + IntToStr(i),
				""), FileIni->ReadString("DB", "Phone" + IntToStr(i), "")))),
				(String) sLineBreak + (String) sLineBreak);
	}

	FileIni->Free();

	RestoreCursor();

	if (S != "")
		Result = MsgBox(S + sLineBreak + sLineBreak + LoadStr(IDS_PING_RESULT),
		MB_YESNOCANCEL | MB_ICONQUESTION);

	return Result;
}
示例#2
0
bool ResizeLogic::OperationCanceledByGME(void)
{
	if (m_resizeState != NotInResize) {
		m_resizeState = NotInResize;
		RestoreCursor();
		m_targetLocation = m_originalLocation;
		if (sizeTrackerDlg != NULL)
			delete sizeTrackerDlg;
	}
	return true;
}
示例#3
0
void __fastcall TAboutObject::Click(TObject *Sender) {
	ShowWaitCursor();

	switch (((TControl*) Sender)->Tag) {
	case 1:
		if (MailAddress != NULL)
			ShellExecEx("mailto:" + MailAddress + "?subject=" +
			MailSubject, "");
		else
			MsgBox(((TControl*) Sender)->Hint);
		break;

	case 2:
		ShellExec(FileInAppDir(LoadStr(IDS_ABOUT_LICENSES)));
	}

	RestoreCursor();
}
示例#4
0
BOOL I4C3DCursor::SetTransparentCursor(LPCTSTR szFilePath)
{
	HCURSOR hCursor = NULL;

	hCursor = LoadCursorFromFile(szFilePath);
	if (hCursor == NULL) {
		LoggingMessage(Log_Error, _T(MESSAGE_ERROR_CURSOR_MISSING), GetLastError(), g_FILE, __LINE__);

		return FALSE;
	}

	if (SetSystemCursor(hCursor, 32512)) {
		return TRUE;
	} else {
		RestoreCursor();
	}
	DestroyCursor(hCursor);	// 現在使用中のカーソルはDestroyすることはできない。

	return FALSE;
}
示例#5
0
bool ResizeLogic::MouseLeftButtonUp(UINT nFlags, const CPoint& point, HDC transformHDC)
{
	if (m_parentPart->IsActive() && m_resizeState != NotInResize) {
		if (m_resizeState == MoveOperation) {
			long deltax = m_targetLocation.left - m_originalLocation.left;
			long deltay = m_targetLocation.top - m_originalLocation.top;
			m_parentPart->WindowMoved(nFlags, CPoint(deltax, deltay));
			m_parentPart->WindowMovingFinished(nFlags, m_targetLocation);
		} else {
			long deltax = m_targetLocation.Width() - m_originalLocation.Width();
			long deltay = m_targetLocation.Height() - m_originalLocation.Height();
			m_parentPart->WindowResized(nFlags, CSize(deltax, deltay));
			m_parentPart->WindowResizingFinished(nFlags, m_targetLocation);
			if (sizeTrackerDlg != NULL)
				delete sizeTrackerDlg;
		}
		m_resizeState = NotInResize;
		RestoreCursor();
		return true;
	}

	return false;
}
示例#6
0
void TMain::ReportMail() {
	if (CheckForSave())
		return;

	ShowWaitCursor();

	try {
		TFileIni* FileIni = CreateINIFile();

		bool UseUTF8      = FileIni->ReadBool("E-Mail", "UseUTF8", false);
		String MailClient = FileIni->ReadString("E-Mail", "Client", "");

		String S = Format(IDS_MAIL_TO,
			ARRAYOFCONST((FileIni->ReadString("E-Mail", "Address", ""),
				StrToUrl(FileIni->ReadString("E-Mail", "Subject", ""), UseUTF8),
				StrToUrl(Memo->Lines->Text, UseUTF8))));

		delete FileIni;

		// MsgBox(S); CopyToClipBoard(S); RestoreCursor(); return;

		if (MailClient != "") {
			if (!EXEIsRunning(MailClient, true)) {
				ShellExec(MailClient);
				Delay(1000);
			}
		}

		ShellExec(S);

	}
	catch (Exception *E) {
		MsgBoxErr(E->Message);
	}

	RestoreCursor();
}
示例#7
0
void ShowAbout(int iFontSize, Byte bLineBreak, Byte bVersionPos, String sDate,
	TPicture *pPicture, String sAddComp, String sVersion, String sAppName,
	String sCopyright, String sText, HICON hIcon) {
	TForm *Form;

	int I;
	String sCaption;

	TVSFixedFileInfo FileVersionInfo;

	String CompanyName, FileDescription, FileVersion, InternalName,
		LegalCopyright, OriginalFilename, ProductName, ProductVersion;

	TAboutObject *AboutObject;

	ShowWaitCursor();
//	Randomize;

	if (IsShift() & IsCtrl()) {
		sAppName = "Дураев";
		sAppName += sLineBreak;
		sAppName += "Константин Петрович";
		sCopyright = "";
		sCaption   = "Автор";
		sDate      = "29.03.1981";
		sVersion   = "";
		iFontSize  = 16;
		sAddComp   = NULL;
		pPicture   = NULL;
		sText      = "";
		for (int i = 1; i < 280; i++)
			if (i % 40 == 0)
				sText = sText + sLineBreak;
			else
				// TODO: 				sText = sText + String(AnsiChar(Chr(Ord('А') +
				// Random(Ord('Я') - Ord('А')))));
					sText = sText + L"Я";
	}
	else {
		GetFileVerInfo(Application->ExeName, FileVersionInfo, CompanyName,
			FileDescription, FileVersion, InternalName, LegalCopyright,
			OriginalFilename, ProductName, ProductVersion);

		sCaption = LoadStr(IDS_ABOUT_CAPTION);

		if (sDate == NULL)
			sDate = FormatDateTime("yyyy.mm.dd",
			UnixToDateTime(((PIMAGE_NT_HEADERS)((DWORD)((PIMAGE_DOS_HEADER)
			HInstance) + (((PIMAGE_DOS_HEADER) HInstance)->e_lfanew)))
			->FileHeader.TimeDateStamp));

		if (sVersion == NULL) {
			sVersion = FileVersion;
			if (IsValueInWord(FileVersionInfo.dwFileFlags, VS_FF_DEBUG))
				sVersion = sVersion + LoadStr(IDS_ABOUT_DEBUG);
			else if (IsValueInWord(FileVersionInfo.dwFileFlags,
				VS_FF_PRERELEASE))
				sVersion = sVersion + LoadStr(IDS_ABOUT_RC);
		}

		if (sAppName == NULL)
			sAppName = ProductName;

		if (sCopyright == NULL)
			sCopyright = LegalCopyright + "|@[email protected]";

		if (sText == NULL) {
			sText = LoadStr(IDS_ABOUT_EULA1) + sLineBreak +
				LoadStr(IDS_ABOUT_EULA2) + sLineBreak + LoadStr(IDS_ABOUT_EULA3)
				+ sLineBreak + LoadStr(IDS_ABOUT_EULA4);
		}

		if (bLineBreak != MAXBYTE) {
			I        = PosPlace(SPACE, sAppName, bLineBreak);
			sAppName = sAppName.SubString(1, I - 1) + sLineBreak +
				sAppName.SubString(I + 1, MAXINT);
		}
	} // IsShift and IsCtrl

	if (hIcon == NULL)
		hIcon = LoadIcon(HInstance, L"MAINICON");

	AboutObject = new TAboutObject();

	Form               = new TForm(Application); // Owner;
	Form->ShowHint     = true;
	Form->Font->Name   = "Arial";
	Form->Font->Size   = 10;
	Form->BorderStyle  = bsDialog;
	Form->Caption      = sCaption;
	Form->ClientHeight = 165;
	Form->ClientWidth  = 420;

	TBevel *bvlIconFrame = new TBevel(Form);
	bvlIconFrame->Parent = Form;
	bvlIconFrame->SetBounds(8, 14, 52, 52);
	bvlIconFrame->Shape = bsFrame;

	TPanel *pnlIcon = new TPanel(Form);
	pnlIcon->Parent = Form;
	pnlIcon->SetBounds(16, 22, 36, 36);
	pnlIcon->Caption          = "";
	pnlIcon->BevelOuter       = bvNone;
	pnlIcon->BorderStyle      = bsSingle;
	pnlIcon->ParentBackground = false;
	pnlIcon->Color            = (TColor) Random(0xFFFFFF);

	TImage *imgIcon                = new TImage(Form); // Icon
	imgIcon->Parent                = pnlIcon;
	imgIcon->Align                 = alClient;
	imgIcon->Transparent           = true;
	imgIcon->Picture->Icon->Handle = hIcon;

	TLabel *lblCopyright      = new TLabel(Form); // Copyright
	lblCopyright->Tag         = 1;
	lblCopyright->Parent      = Form;
	lblCopyright->Font->Style = TFontStyles() << fsBold;
	lblCopyright->SetBounds(8, 80, 0, 0);

	int PosHint = Pos('|', sCopyright);
	if (PosHint == 0)
		lblCopyright->Caption = sCopyright;
	else {
		lblCopyright->Caption      = sCopyright.SubString(1, PosHint - 1);
		lblCopyright->Hint         = sCopyright.SubString(PosHint + 1, MAXINT);
		lblCopyright->Cursor       = crHandPoint;
		lblCopyright->OnMouseEnter = AboutObject->MouseEnter;
		lblCopyright->OnMouseLeave = AboutObject->MouseLeave;
		if (lblCopyright->Hint[1] == '@') {
			lblCopyright->Hint = lblCopyright->Hint.SubString(2, MAXINT);

			AboutObject->MailAddress = lblCopyright->Hint;
			AboutObject->MailSubject = OriginalFilename + " " + FileVersion;
		}
		lblCopyright->OnClick = AboutObject->Click;
	}

	TLabel *lblText = new TLabel(Form); // Text
	lblText->Parent   = Form;
	lblText->WordWrap = true;
	lblText->SetBounds(8, 100, Form->ClientWidth - 16, 0);
	lblText->Caption = sText;
	// I                  =
	lblText->Top + lblText->Height;
	Form->ClientHeight = Form->ClientHeight + lblText->Height;

	if (sAddComp != NULL) {
		/* with TBevel.Create(Form) do
		 {
		 Parent = Form;
		 SetBounds(7, I + 5, Form.ClientWidth - 15, 5);
		 Shape = bsTopLine;
		 I = Top + Height;
		 };

		 with TLabel.Create(Form) do // Add Components
		 {
		 Parent = Form;
		 SetBounds(8, I, 0, 0);
		 Caption = 'Программное обеспечение использует следующие компоненты:';
		 I = Top + Height;
		 };

		 with TLabel.Create(Form) do // Components
		 {
		 Tag = 2;
		 Parent = Form;
		 Font.Style = [fsBold];
		 SetBounds(8, I, 0, 0);
		 Caption = sAddComp;
		 Form.ClientHeight = Form.ClientHeight + Height + 12;
		 if FileExists(FileInAppDir(rsLicenses)) then
		 {
		 Cursor = crHandPoint;
		 OnClick = ClickObject.Click;
		 OnMouseEnter = ClickObject.MouseEnter;
		 OnMouseLeave = ClickObject.MouseLeave;
		 };
		 } */
	}
	else // sAddComp != NULL
			Form->ClientHeight = Form->ClientHeight - 12;

	TBevel *bvlBottom = new TBevel(Form);
	bvlBottom->Parent = Form;
	bvlBottom->SetBounds(7, Form->ClientHeight - 43, Form->ClientWidth - 15, 5);
	bvlBottom->Shape = bsTopLine;

	lblMemory         = new TLabel(Form); // Физическая ...
	lblMemory->Parent = Form;
	lblMemory->SetBounds(8, Form->ClientHeight - 38, 0, 0);
	lblMemory->Caption = LoadStr(IDS_ABOUT_MEMORY);

	lblMemoryValue              = new TLabel(Form); // TotalPhys
	lblMemoryValue->Parent      = Form;
	lblMemoryValue->Font->Style = TFontStyles() << fsBold;
	lblMemoryValue->SetBounds(lblMemory->Width + 13,
		Form->ClientHeight - 38, 0, 0);

	lblProc         = new TLabel(Form); // Процессор:
	lblProc->Parent = Form;
	lblProc->SetBounds(8, Form->ClientHeight - 22, 0, 0);
	lblProc->Caption = LoadStr(IDS_ABOUT_PROCESSOR);

	lblProcValue              = new TLabel(Form); // CPUSpeed
	lblProcValue->Parent      = Form;
	lblProcValue->Font->Style = TFontStyles() << fsBold;
	lblProcValue->SetBounds(lblMemory->Width + 13,
		Form->ClientHeight - 22, 0, 0);

	TGradientPanel *pnlName = new TGradientPanel(Form);
	pnlName->Parent = Form;
	pnlName->StartUpdate();
	pnlName->SetBounds(68, 8, Form->ClientWidth - 76, 64);
	pnlName->BorderStyle = bsSingle;

	pnlName->BevelOuter       = bvNone;
	pnlName->ParentBackground = false;
	if (pPicture == NULL) pnlName->ColorStart = pnlIcon->Color;
	else pnlName->ColorStart = clBlack;
	pnlName->ColorEnd = clBlack;
	pnlName->EndUpdate();

	if (pPicture == NULL) {
		TLabel *lblAppName = new TLabel(Form); // Application Name (1)
		lblAppName->Parent = pnlName;
		lblAppName->SetBounds(2, 2, Form->ClientWidth - 83, 58);
		lblAppName->Alignment     = taCenter;
		lblAppName->AutoSize      = false;
		lblAppName->Caption       = sAppName;
		lblAppName->ParentColor   = false;
		lblAppName->Color         = clBlack;
		lblAppName->ParentFont    = false;
		lblAppName->Font->Charset = DEFAULT_CHARSET;
		lblAppName->Font->Color   = clBlack;
		lblAppName->Font->Height  = -51;
		lblAppName->Font->Name    = "Courier New";
		lblAppName->Font->Style   = TFontStyles() << fsBold << fsItalic;
		lblAppName->Font->Size    = iFontSize;
		lblAppName->Transparent   = true;
		lblAppName->Layout        = tlCenter;
		lblAppName->WordWrap      = true;

		TLabel *lblAppName2 = new TLabel(Form); // Application Name (2)
		lblAppName2->Parent = pnlName;
		lblAppName2->SetBounds(0, 0, Form->ClientWidth - 83, 58);
		lblAppName2->Alignment     = taCenter;
		lblAppName2->AutoSize      = false;
		lblAppName2->Caption       = sAppName;
		lblAppName2->ParentColor   = false;
		lblAppName2->Color         = clBlack;
		lblAppName2->ParentFont    = false;
		lblAppName2->Font->Charset = DEFAULT_CHARSET;
		lblAppName2->Font->Color   = clWhite;
		lblAppName2->Font->Height  = -51;
		lblAppName2->Font->Name    = "Courier New";
		lblAppName2->Font->Style   = TFontStyles() << fsBold << fsItalic;
		lblAppName2->Font->Size    = iFontSize;
		lblAppName2->Transparent   = true;
		lblAppName2->Layout        = tlCenter;
		lblAppName2->WordWrap      = true;
	} // pPicture == NULL
	else {
		TImage *imgPicture = new TImage(Form);
		imgPicture->Parent = pnlName;
		imgPicture->Align  = alClient;
		imgPicture->Picture->Assign(pPicture);
	}

	TLabel *lblDate = new TLabel(Form); // Date
	lblDate->Parent  = pnlName;
	lblDate->Caption = sDate;
	lblDate->Font->Assign(Form->Font);
	lblDate->Font->Style = TFontStyles() << fsBold;
	lblDate->Font->Color = clWhite;
	lblDate->Font->Size  = 8;
	lblDate->Alignment   = taRightJustify;

	switch (3) {
	case 0:
		lblDate->SetBounds(2, 2, lblDate->Width, lblDate->Height);
		break;
	case 1:
		lblDate->SetBounds(2, pnlName->ClientHeight - lblDate->Height - 2,
			lblDate->Width, lblDate->Height);
		break;
	case 2:
		lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2, 2,
			lblDate->Width, lblDate->Height);
		break;
	default:
		lblDate->SetBounds(pnlName->ClientWidth - lblDate->Width - 2,
			pnlName->ClientHeight - lblDate->Height - 2, lblDate->Width,
			lblDate->Height);
	}
	lblDate->Transparent = true;

	TLabel *lblVerion  = new TLabel(Form); // Version
	lblVerion->Parent  = pnlName;
	lblVerion->Caption = sVersion;
	lblVerion->Font->Assign(Form->Font);
	lblVerion->Font->Style = TFontStyles() << fsBold;
	lblVerion->Font->Color = clWhite;
	lblVerion->Font->Size  = 8;

	switch (2) {
	case 0:
		lblVerion->SetBounds(2, 2, lblVerion->Width, lblVerion->Height);
		break;
	case 1:
		lblVerion->SetBounds(2, pnlName->ClientHeight - lblVerion->Height - 2,
			lblVerion->Width, lblVerion->Height);
		break;
	case 2:
		lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2, 2,
			lblVerion->Width, lblVerion->Height);
		break;
	default:
		lblVerion->SetBounds(pnlName->ClientWidth - lblVerion->Width - 2,
			pnlName->ClientHeight - lblVerion->Height - 2, lblVerion->Width,
			lblVerion->Height);
	}
	lblVerion->Transparent = true;

	TButton *btnClose     = new TButton(Form);
	btnClose->Parent      = Form;
	btnClose->Caption     = "OK";
	btnClose->ModalResult = mrCancel;
	btnClose->Cancel      = true;
	btnClose->SetBounds(Form->ClientWidth - 83, Form->ClientHeight - 34,
		75, 26);
	btnClose->TabOrder = 0;

	TTimer *timer   = new TTimer(Form);
	timer->OnTimer  = AboutObject->TimerTimer;
	timer->Interval = 1;
	timer->Enabled  = true;

	RestoreCursor();

	Form->Left = (Screen->Width - Form->Width) / 2;
	Form->Top  = (Screen->Height - Form->Height) / 2;

	SetCurPosToCenter(btnClose);

	Form->ShowModal();

	Form->Free();
	AboutObject->Free();

	lblMemory      = NULL;
	lblProc        = NULL;
	lblMemoryValue = NULL;
	lblProcValue   = NULL;
}
示例#8
0
	~CWaitCursor()
	{
		RestoreCursor();
	}
示例#9
0
/*
 * SelectLineInFile - select a line in a given file
 */
vi_rc SelectLineInFile( selflinedata *sfd )
{
    int         i, winflag;
    int         leftcol = 0, key2;
    bool        done = FALSE, redraw = TRUE;
    bool        hiflag = FALSE, drawbord = FALSE;
    int         farx, text_lines;
    linenum     pagetop = 1, lln = 1;
    char        tmp[MAX_STR];
    hilst       *ptr;
    linenum     cln;
    linenum     endline;
    vi_rc       rc;
    vi_key      key;

    /*
     * create the window
     */
    cln = sfd->cln;
    endline = sfd->f->fcbs.tail->end_line;
    farx = sfd->wi->x2;
    if( sfd->show_lineno ) {
        farx++;
    }
    if( sfd->hilite != NULL ) {
        hiflag = TRUE;
    }
    rc = NewWindow2( &cWin, sfd->wi );
    if( rc != ERR_NO_ERR ) {
        return( rc );
    }
    if( !sfd->is_menu ) {
        WindowAuxUpdate( cWin, WIND_INFO_HAS_SCROLL_GADGETS, TRUE );
        DrawBorder( cWin );
    }
    oWin = sfd->eiw;
    isMenu = sfd->is_menu;
    PushMouseEventHandler( SelectLineMouseHandler );
    KillCursor();
    text_lines = WindowAuxInfo( cWin, WIND_INFO_TEXT_LINES );
    sfd->sl = -1;
    if( sfd->title != NULL ) {
        WindowTitle( cWin, sfd->title );
    }
    pagetop = text_lines * (cln / text_lines);
    if( cln % text_lines != 0 ) {
        pagetop++;
    }
    key = 0;
    if( LastEvent == VI_KEY( MOUSEEVENT ) ) {
        DisplayMouse( TRUE );
    }

    /*
     * now, allow free scrolling and selection
     */
    while( !done ) {

        if( redraw ) {
            if( sfd->show_lineno ) {
                MySprintf(tmp, "%l/%l", cln, endline );
                i = sfd->wi->x2 - sfd->wi->x1;
                WindowBorderData( cWin, tmp, i - strlen( tmp ) );
                drawbord = TRUE;
            }
            if( hiflag ) {
                ptr = sfd->hilite;
                ptr += cln - 1;
                if( ptr->_char == (char)-1 ) {
                    if( cln > lln ) {
                        cln++;
                    } else if( cln < lln ) {
                        cln--;
                    }
                }
            }
            if( drawbord ) {
                DrawBorder( cWin );
            }
            displayGenericLines( sfd->f, pagetop, leftcol, cln, &(sfd->wi->hilight), sfd->hilite, sfd->vals, sfd->valoff );
        }
        lln = cln;
        redraw = TRUE;
        drawbord = FALSE;
        mouseLine = -1;
        rlMenu = FALSE;
        if( key == VI_KEY( MOUSEEVENT ) ) {
            DisplayMouse( TRUE );
        }
        key = GetNextEvent( TRUE );
        if( hiflag && ((key >= VI_KEY( ALT_A ) && key <= VI_KEY( ALT_Z )) ||
                       (key >='a' && key <= 'z') || (key >= 'A' && key <= 'Z') ||
                       (key >= '1' && key <= '9')) ) {
            i = 0;
            if( key >= VI_KEY( ALT_A ) && key <= VI_KEY( ALT_Z ) ) {
                key2 = key - VI_KEY( ALT_A ) + 'A';
            } else if( key >= 'a' && key <= 'z' ) {
                key2 = key - 'a' + 'A';
            } else {
                key2 = key;
            }
            ptr = sfd->hilite;
            while( ptr->_char != '\0' ) {
                if( toupper( ptr->_char ) == key2 ) {
                    cln = i + 1;
                    key = VI_KEY( ENTER );
                    break;
                }
                ++i;
                ++ptr;
            }
        }

        /*
         * check if a return-event has been selected
         */
        if( sfd->retevents != NULL ) {
            i = 0;
            if( key == VI_KEY( MOUSEEVENT ) ) {
                if( mouseWin == oWin && LastMouseEvent == MOUSE_PRESS ) {
                    DisplayMouse( FALSE );
                    sfd->event = sfd->retevents[mouseLine];
                    key = VI_KEY( ENTER );
                }
            } else {
                while( sfd->retevents[i] != 0 ) {
                    if( key == sfd->retevents[i] ) {
                        sfd->event = key;
                        key = VI_KEY( ENTER );
                        break;
                    }
                    i++;
                }
            }
        }

        /*
         * process key stroke
         */
        switch( key ) {
        case VI_KEY( MOUSEEVENT ):
            DisplayMouse( FALSE );
            if( hiflag ) {
                ptr = sfd->hilite;
                ptr += mouseLine;
                if( ptr->_char == (char) -1 ) {
                    break;
                }
            }
            if( rlMenu && sfd->allow_rl != NULL ) {
                *(sfd->allow_rl) = rlMenuNum;
                done = TRUE;
                break;
            }
            if( mouseScroll != MS_NONE ) {
                switch( mouseScroll ) {
                case MS_UP: goto evil_up;
                case MS_DOWN: goto evil_down;
                case MS_PAGEUP: goto evil_pageup;
                case MS_PAGEDOWN: goto evil_pagedown;
                case MS_EXPOSEDOWN:
                    adjustCLN( &cln, &pagetop, pagetop + text_lines - cln - 1, endline, text_lines );
                    adjustCLN( &cln, &pagetop, 1, endline, text_lines );
                    drawbord = TRUE;
                    break;
                case MS_EXPOSEUP:
                    adjustCLN( &cln, &pagetop, pagetop - cln, endline, text_lines );
                    adjustCLN( &cln, &pagetop, -1, endline, text_lines );
                    drawbord = TRUE;
                    break;

                }
                break;
            }
            switch( LastMouseEvent ) {
            case MOUSE_DRAG:
                if( mouseWin != cWin ) {
                    break;
                }
                cln = mouseLine + pagetop;
                break;
            case MOUSE_RELEASE:
                if( !sfd->is_menu ) {
                    break;
                }
                if( mouseWin == cWin ) {
                    cln = mouseLine + pagetop;
                    if( cln <= endline ) {
                        goto evil_enter;
                    }
                }
                break;
            case MOUSE_DCLICK:
                if( mouseWin != cWin ) {
                    AddCurrentMouseEvent();
                    done = TRUE;
                } else {
                    cln = mouseLine + pagetop;
                    if( cln <= endline ) {
                        goto evil_enter;
                    }
                }
                break;
            case MOUSE_PRESS_R:
                if( mouseWin != cWin ) {
                    AddCurrentMouseEvent();
                    done = TRUE;
                }
                break;
            case MOUSE_PRESS:
                if( mouseWin != cWin ) {
                    AddCurrentMouseEvent();
                    done = TRUE;
                } else {
                    cln = mouseLine + pagetop;
                }
                break;
            }
            break;

        case VI_KEY( ESC ):
            done = TRUE;
            break;

        evil_enter:
        case VI_KEY( ENTER ):
        case ' ':
            /*
             * see if we need to do a callback for this
             */
            if( sfd->checkres != NULL ) {
                line    *cline;
                fcb     *cfcb;
                char    data[64];

                i = cln - 1;
                GimmeLinePtr( cln, sfd->f, &cfcb, &cline );
                strcpy( data, cline->data );
                RemoveLeadingSpaces( data );
                winflag = FALSE;
                strcpy( tmp, sfd->vals[i] );
                rc = sfd->checkres( data, tmp, &winflag );
                if( winflag ) {
                    if( winflag == 2 ) {
                        winflag = TRUE;
                    } else {
                        winflag = FALSE;
                    }
                }
                if( winflag ) {
                    MoveWindowToFront( cWin );
                }
                if( rc == ERR_NO_ERR ) {
                    AddString2( &(sfd->vals[i]), tmp );
                    redraw = TRUE;
                }
                break;

            /*
             * no value window, so just return line selected
             */
            } else {
                if( isMenu && InvokeMenuHook( CurrentMenuNumber, cln ) == -1 ) {
                    break;
                }
                sfd->sl = cln;
                done = TRUE;
            }
            break;

        case VI_KEY( LEFT ):
        case 'h':
            if( sfd->allow_rl != NULL ) {
                *(sfd->allow_rl) = -1;
                done = TRUE;
            }
            break;

        case VI_KEY( RIGHT ):
        case 'l':
            if( sfd->allow_rl != NULL ) {
                *(sfd->allow_rl) = 1;
                done = TRUE;
            }
            break;

        evil_up:
        case VI_KEY( UP ):
        case 'k':
            drawbord = adjustCLN( &cln, &pagetop, -1, endline, text_lines );
            break;

        evil_down:
        case VI_KEY( DOWN ):
        case 'j':
            drawbord = adjustCLN( &cln, &pagetop, 1, endline, text_lines );
            break;

        case VI_KEY( CTRL_PAGEUP ):
            drawbord = adjustCLN( &cln, &pagetop, -cln + 1, endline, text_lines );
            break;

        case VI_KEY( CTRL_PAGEDOWN ):
            drawbord = adjustCLN( &cln, &pagetop, endline - cln, endline, text_lines );
            break;

        evil_pageup:
        case VI_KEY( PAGEUP ):
        case VI_KEY( CTRL_B ):
            drawbord = adjustCLN( &cln, &pagetop, -text_lines, endline, text_lines );
            break;

        evil_pagedown:
        case VI_KEY( PAGEDOWN ):
        case VI_KEY( CTRL_F ):
            drawbord = adjustCLN( &cln, &pagetop, text_lines, endline, text_lines );
            break;

        case VI_KEY( HOME ):
            drawbord = TRUE;
            cln = 1;
            pagetop = 1;
            break;

        case VI_KEY( END ):
            drawbord = TRUE;
            cln = endline;
            pagetop = endline - text_lines + 1;
            if( pagetop < 1 ) {
                pagetop = 1;
            }
            break;

        default:
            redraw = FALSE;
            break;

        }

    }
    PopMouseEventHandler();
    CloseAWindow( cWin );
    RestoreCursor();
    SetWindowCursor();
    return( rc );

} /* SelectLineInFile */
示例#10
0
bool TMain::ReportUpdate() {
	int i, line;
	String S    = "", Name = "", DBResult, DBResultOK, DBResultError;
	bool Result = true;

	ShowWaitCursor();

	TFileIni* FileIni = CreateINIFile();

	try {
		tbtnUpdate->Enabled = false;
		tbtnMail->Enabled   = false;
		tbtnSave->Enabled   = false;

		PanelDate->Enabled = false;

		Memo->Lines->Clear();

		Memo->Lines->Add(LoadStr(IDS_UPDATE_WAIT) + sLineBreak);

		ProcMess();

		if (ReportType == 1)
			S = Format(IDS_REPORT_CAPTION_1,
				ARRAYOFCONST((DTToS(DateTimeFrom), DTToS(DateTimeTo))));
		else
			S = Format(IDS_REPORT_CAPTION_0, DToS(DateTimeFrom));

		S += sLineBreak;

		DBResultOK    = LoadStr(IDS_UPDATE_OK);
		DBResultError = LoadStr(IDS_UPDATE_ERROR);

		for (int i = 1; i <= FileIni->ReadInteger("DB", "Count", 0); i++) {
			ProcMess();

			Name = FileIni->ReadString("DB", "Name" + IntToStr(i), "");

			S = S + sLineBreak + Name + sLineBreak;

			line = Memo->Lines->Add(Name + "... ");

			if (LoadData(FileIni->ReadString("DB", "Path" + IntToStr(i), ""),
					DateTimeFrom, DateTimeTo, S))
				DBResult = DBResultOK;
			else {
				Result   = false;
				DBResult = DBResultError;
			}

			Memo->Lines->Strings[line] = Memo->Lines->Strings[line] + DBResult +
				sLineBreak;

			// Delay(2000);
		}
	} catch (Exception *E) {
		S = E->Message;
	}

	FileIni->Free();

	Delay(200);

	Memo->Text = S;

	tbtnUpdate->Enabled = true;
	tbtnMail->Enabled   = true;
	tbtnSave->Enabled   = true;
	PanelDate->Enabled  = true;

	RestoreCursor();

	return Result;
}
示例#11
0
/**
**	Hide cursor.
*/
global void HideCursor(void)
{
    RestoreCursor();
}
示例#12
0
bool ResizeLogic::MouseMoved(UINT nFlags, const CPoint& point, HDC transformHDC)
{
	if (m_parentPart->IsActive()) {
		m_targetLocation = m_parentPart->GetLocation();
		ResizeType resizeTypeCandidate = DeterminePotentialResize(point);
		HRESULT retVal = S_OK;
		if (m_resizeState == NotInResize) {
			if (resizeTypeCandidate != NotInResize) {
				ChangeCursorForm(resizeTypeCandidate);
				m_bCursorSaved = true;
				return true;
			} else {
				RestoreCursor();
			}
		} else {
			long deltax = point.x - m_originalMousePosition.x;
			long deltay = point.y - m_originalMousePosition.y;
			// Change size/m_targetLocation
			CRect newTargetLocation = m_originalLocation;
			long widthMinLimit = max(5, m_minSize.cx);
			long heightMinLimit = max(5, m_minSize.cy);
			// Horizontal limiting
			switch(m_resizeState) {
				case RightEdgeResize:
				case TopRightCornerResize:
				case BottomRightCornerResize:
					{
						if (newTargetLocation.Width() + deltax < widthMinLimit)
							deltax = widthMinLimit - newTargetLocation.Width();
					}
					break;
				case LeftEdgeResize:
				case TopLeftCornerResize:
				case BottomLeftCornerResize:
					{
						if (newTargetLocation.Width() - deltax < widthMinLimit)
							deltax = newTargetLocation.Width() - widthMinLimit;
					}
					break;
			}
			// Vertical limiting
			switch(m_resizeState) {
				case BottomEdgeResize:
				case BottomRightCornerResize:
				case BottomLeftCornerResize:
					{
						if (newTargetLocation.Height() + deltay < heightMinLimit)
							deltay = heightMinLimit - newTargetLocation.Height();
					}
					break;
				case TopEdgeResize:
				case TopLeftCornerResize:
				case TopRightCornerResize:
					{
						if (newTargetLocation.Height() - deltay < heightMinLimit)
							deltay = newTargetLocation.Height() - heightMinLimit;
					}
					break;
			}
			// Nop filtering
			switch(m_resizeState) {
				case RightEdgeResize:
				case LeftEdgeResize:
					{
						if (deltax == 0)
							return true;
					}
					break;
				case BottomEdgeResize:
				case TopEdgeResize:
					{
						if (deltay == 0)
							return true;
					}
					break;
				case TopLeftCornerResize:
				case TopRightCornerResize:
				case BottomRightCornerResize:
				case BottomLeftCornerResize:
					{
						if (deltax == 0 && deltay == 0)
							return true;
					}
					break;
			}
			// Adjust rect
			switch(m_resizeState) {
				case RightEdgeResize:			newTargetLocation.InflateRect(0,		0,			deltax,	0		);	break;
				case BottomEdgeResize:			newTargetLocation.InflateRect(0,		0,			0,		deltay	);	break;
				case LeftEdgeResize:			newTargetLocation.InflateRect(-deltax,	0,			0,		0		);	break;
				case TopEdgeResize:				newTargetLocation.InflateRect(0,		-deltay,	0,		0		);	break;
				case TopLeftCornerResize:		newTargetLocation.InflateRect(-deltax,	-deltay,	0,		0		);	break;
				case TopRightCornerResize:		newTargetLocation.InflateRect(0,		-deltay,	deltax,	0		);	break;
				case BottomRightCornerResize:	newTargetLocation.InflateRect(0,		0,			deltax,	deltay	);	break;
				case BottomLeftCornerResize:	newTargetLocation.InflateRect(-deltax,	0,			0,		deltay	);	break;
				case MoveOperation:				newTargetLocation.OffsetRect(deltax, deltay);							break;
			}
			// keep aspect ratio if it's a corner resize
			if ((nFlags & MK_CONTROL) != 0) {
				double aspect_ratio = (double)m_originalLocation.Width() / (double)m_originalLocation.Height();
				long other_y = (long)(newTargetLocation.Width() / aspect_ratio);
				long other_x = (long)(newTargetLocation.Height() * aspect_ratio);
				if (other_y > newTargetLocation.Height()) {
					long dy = other_y - newTargetLocation.Height();
					if (m_resizeState == TopRightCornerResize ||
						m_resizeState == TopLeftCornerResize ||
						m_resizeState == TopEdgeResize)
					{
						newTargetLocation.top -= dy;
					} else {
						newTargetLocation.bottom += dy;
					}
				} else if (other_x > newTargetLocation.Width()) {
					long dx = other_x - newTargetLocation.Width();
					if (m_resizeState == TopLeftCornerResize ||
						m_resizeState == BottomLeftCornerResize ||
						m_resizeState == LeftEdgeResize)
					{
						newTargetLocation.left -= dx;
					} else {
						newTargetLocation.right += dx;
					}
				} else {
					// Cannot be satisfied completely because of the rounding
					//ASSERT((double)newTargetLocation.Width() / (double)newTargetLocation.Height() ==
					//	   (double)m_originalLocation.Width() / (double)m_originalLocation.Height());
				}
			}
			m_targetLocation = newTargetLocation;
			if (m_resizeState == MoveOperation) {
				m_parentPart->WindowMoving(nFlags, m_targetLocation);
			} else {
				m_parentPart->WindowResizing(nFlags, m_targetLocation);
				if (sizeTrackerDlg != NULL)
					sizeTrackerDlg->AdjustPositionAndText(point, m_targetLocation);
			}
			return true;
		}
	} else {
		RestoreCursor();
	}

	return false;
}
示例#13
0
I4C3DCursor::~I4C3DCursor(void)
{
	RestoreCursor();
}
示例#14
0
void
QvisMessageWindow::Update(Subject *)
{
    MessageAttributes *ma = (MessageAttributes *)subject;

    MessageAttributes::Severity severity = ma->GetSeverity();
    if(severity == MessageAttributes::ErrorClear)
        return;

    double secondsSinceLastMessage = DELTA_TOA_THIS_LINE;
    QString msgText;
    if (secondsSinceLastMessage < 5.0)
    {
        MessageAttributes::Severity oldSeverity;
        QString oldSeverityLabel = severityLabel->text();
        if (oldSeverityLabel == tr("Error!"))
            oldSeverity = MessageAttributes::Error;
        else if (oldSeverityLabel == tr("Warning"))
            oldSeverity = MessageAttributes::Warning;
        else if (oldSeverityLabel == tr("Message"))
            oldSeverity = MessageAttributes::Message;
        else if (oldSeverityLabel == tr("Information"))
            oldSeverity = MessageAttributes::Information;
        else
            oldSeverity = MessageAttributes::Error;

        // If we're not in information mode, append the incoming messages
        if(!preserveInformation)
        {
            // set severity to whichever is worse
            if (oldSeverity < severity)
                severity = oldSeverity;

            // catenate new message onto old 
            msgText = messageText->toPlainText();
            QString newMsgText = MessageAttributes_GetText(*ma);
            if (msgText.indexOf(newMsgText) == -1)
            {
                msgText += "\n\n";
                msgText += tr("Shortly thereafter, the following occured...");
                msgText += "\n\n";
                msgText += newMsgText;
            }
        }
        else if(severity == MessageAttributes::Information)
        {
            msgText = MessageAttributes_GetText(*ma);
            preserveInformation = false;
        }
        else if((severity == MessageAttributes::Error ||
                 severity == MessageAttributes::Warning) &&
                 oldSeverity == MessageAttributes::Information)
        {
            // Incoming Error, Warnings may overwrite Information.
            msgText = MessageAttributes_GetText(*ma);
            preserveInformation = false;
        }
    }
    else
    {
        msgText = MessageAttributes_GetText(*ma);
        
        // Don't preserve information if a new information message is
        // coming in. Also let error, warning override the existing
        // information message.
        if(preserveInformation && 
           (severity == MessageAttributes::Error ||
            severity == MessageAttributes::Warning ||
            severity == MessageAttributes::Information))
        {
            preserveInformation = false;
        }
    }

    if(!preserveInformation)
    {
        // Set the severity label text.
        if(severity == MessageAttributes::Error)
        {
            show();
            qApp->beep();
            severityLabel->setText(tr("Error!"));
            RestoreCursor();
        }
        else if(severity == MessageAttributes::Warning)
        {
            if (enableWarningPopups)
                show();
            severityLabel->setText(tr("Warning"));
            RestoreCursor();
        }
        else if(severity == MessageAttributes::Message)
            severityLabel->setText(tr("Message"));
        else if(severity == MessageAttributes::Information)
        {
            show();
            severityLabel->setText(tr("Information"));
            RestoreCursor();
            preserveInformation = true;
        }

        // Set the message text.
        messageText->setText(msgText);
    }
}