Пример #1
0
void HandleSetAuthor(void) {
	char buffer[64], buffer_utf8[64];
	char *pbuffer = buffer, *pbuffer_utf8 = buffer_utf8;
	size_t buffersiz, buffersiz_utf8 = sizeof(buffer_utf8), bytes;
	iconv_t cd;

	LeaveFullScreen();
	puts("Enter name of author:");
	chompgets(buffer, sizeof(buffer), stdin);
	buffersiz = strlen(buffer);

	cd = iconv_open("UTF-8", nl_langinfo(CODESET));
	bytes = iconv(cd, &pbuffer, &buffersiz, &pbuffer_utf8, &buffersiz_utf8);
	if (bytes == (size_t)(-1)) {
		perror("iconv");
		iconv_close(cd);
		return;
	}
	iconv_close(cd);

	*pbuffer_utf8 = '\0';

	MvidSetAuthor(buffer_utf8);

	EnterFullScreen();
}
Пример #2
0
void HandlePlaybackMovie(void) {
	char buffer[64];
	LeaveFullScreen();
	puts("Enter name of movie to begin playback:");
	chompgets(buffer, sizeof(buffer), stdin);
	MvidStart(buffer, PLAYBACK_MODE, 0, 0);
	EnterFullScreen();
}
Пример #3
0
void HandleRecordMovie(int reset) {
	char buffer[64];
	LeaveFullScreen();
	printf("Enter name of movie to begin recording%s:\n", reset ? " from reset" : "");
	chompgets(buffer, sizeof(buffer), stdin);
	MvidStart(buffer, RECORD_MODE, reset, 0);
	EnterFullScreen();
}
Пример #4
0
void HandleLoadState() {
	char buffer[64];
	LeaveFullScreen();
	puts("Enter name of state to load:");
	chompgets(buffer, sizeof(buffer), stdin);
	StateLoad(buffer);
	EnterFullScreen();
}
Пример #5
0
void HandleSaveState() {
	char buffer[64];
	LeaveFullScreen();
	puts("Enter name of state to save:");
	chompgets(buffer, sizeof(buffer), stdin);
	StateSave(buffer);
	EnterFullScreen();
}
Пример #6
0
void HandlePythonREPL(void) {
	if (!python) {
		puts("Python not available!");
		return;
	}
	LeaveFullScreen();
	MPyEmbed_Repl();
	EnterFullScreen();
}
Пример #7
0
void HandlePython(void) {
	char buffer[64];
	LeaveFullScreen();
	
	if (!python) {
		puts("Python not available!");
		return;
	}

	puts("Enter name of Python control script to execute:");
	chompgets(buffer, sizeof(buffer), stdin);

	EnterFullScreen();

	MPyEmbed_Run(buffer);
}
Пример #8
0
void HandlePythonThread(void) {
	char *buffer = malloc(64);
	pthread_t pythread;
	LeaveFullScreen();
	
	if (!python) {
		puts("Python not available!");
		return;
	}

	puts("Enter name of Python viewer script to execute:");
	chompgets(buffer, 64, stdin);

	EnterFullScreen();

	pthread_create(&pythread, 0, PythonThreadRun, buffer);
}
Пример #9
0
static WindowInfo *LoadOnStartup(const WCHAR *filePath, CommandLineInfo& i, bool isFirstWin)
{
    LoadArgs args(filePath);
    args.showWin = !(i.printDialog && i.exitWhenDone) && !gPluginMode;
    WindowInfo *win = LoadDocument(args);
    if (!win)
        return win;

    if (win->IsDocLoaded() && i.destName && isFirstWin) {
        win->linkHandler->GotoNamedDest(i.destName);
    } else if (win->IsDocLoaded() && i.pageNumber > 0 && isFirstWin) {
        if (win->ctrl->ValidPageNo(i.pageNumber))
            win->ctrl->GoToPage(i.pageNumber, false);
    }
    if (i.hwndPluginParent)
        MakePluginWindow(*win, i.hwndPluginParent);
    if (!win->IsDocLoaded() || !isFirstWin)
        return win;

    if (i.enterPresentation || i.enterFullScreen) {
        if (i.enterPresentation && win->isFullScreen || i.enterFullScreen && win->presentation)
            ExitFullScreen(*win);
        EnterFullScreen(*win, i.enterPresentation);
    }
    if (i.startView != DM_AUTOMATIC)
        SwitchToDisplayMode(win, i.startView);
    if (i.startZoom != INVALID_ZOOM)
        ZoomToSelection(win, i.startZoom);
    if ((i.startScroll.x != -1 || i.startScroll.y != -1) && win->AsFixed()) {
        DisplayModel *dm = win->AsFixed();
        ScrollState ss = dm->GetScrollState();
        ss.x = i.startScroll.x;
        ss.y = i.startScroll.y;
        dm->SetScrollState(ss);
    }
    if (i.forwardSearchOrigin && i.forwardSearchLine && win->AsFixed() && win->AsFixed()->pdfSync) {
        UINT page;
        Vec<RectI> rects;
            ScopedMem<WCHAR> sourcePath(path::Normalize(i.forwardSearchOrigin));
        int ret = win->AsFixed()->pdfSync->SourceToDoc(sourcePath, i.forwardSearchLine, 0, &page, rects);
        ShowForwardSearchResult(win, sourcePath, i.forwardSearchLine, 0, ret, page, rects);
    }
    return win;
}