/usr/share/pdfedit/menu.qs is in pdfedit 0.4.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | /*
* PDFedit - free program for PDF document manipulation.
* Copyright (C) 2006-2009 PDFedit team: Michal Hocko,
* Jozef Misutka,
* Martin Petricek
* Former team members: Miroslav Jahoda
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in doc/LICENSE.GPL); if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Project is hosted on http://sourceforge.net/projects/pdfedit
*/
/* ==== Functions called directly from menu ==== */
/** Save (action from menu/toolbar) */
function func_save() {
if (!save()) {
err=error();
warn(err);
return false;
}
return true;
}
/** Save new revision (action from menu/toolbar) */
function func_saverev() {
if (!saveRevision()) {
err=error();
warn(err);
return false;
} else {
print(tr("New revision of document created"));
return true;
}
}
/** Show/hide certain window (toggle) */
function showHide(win,item) {
vis=isVisible(win);
setVisible(win,!vis);
toggleVisItem(win,item);
}
/** Save a copy of the curent revision (action from menu/toolbar). Asks for name, then saves under new name */
function func_clonerevision() {
var name=fileSaveDialog(filename());
if (!name) return false;
if (!saveCopy(name)) {
err=error();
warn(err);
return false;
} else {
print(tr("Saved as")+" "+name);
return true;
}
}
/** Open new file (action from menu/toolbar) */
function func_load() {
if (!closeFile(true,true)) return;
var name=fileOpenDialog();
try {
if (name) {
openFile(name);
if (document.isLinearized()) {
print(tr('Warning: This document is linearized PDF!'));
}
enc=document.isEncrypted();
if (enc) {
print(tr('Warning: This document is encrypted!'));
}
}
} catch (e) {
print(tr("Error occured while loading file")+" "+name);
}
}
/** Save all text from document to single file */
function save_as_text(filename) {
pages=document.getPageCount();
qs="";
for (i=1;i<=pages;i++) {
pg=document.getPage(i);
text=pg.getText();
qs+=text;
qs+="\n";
}
saveFile(filename,qs);
print(tr("Text saved to %1").arg(filename));
}
/** Callback when selection mode is changed to draw new arrow */
function func_saveastext() {
name=FileDialog.getSaveFileName("*.txt",tr("Save as text file"));
if (name==undefined) return;
save_as_text(name);
}
/** close current file and create a new one (action from menu/toolbar) */
function func_new() {
closeFile(true);
checkMenus();
}
/** Create new empty editor window */
function newwindow() {
createNewWindow();
}
/** Print names of childs of currently selected tree item to console */
function printTreeChilds() {
names=firstSelectedItem().getChildNames();
for(var i=0;i<names.length;i++) {
print(names[i]);
}
}
/** invoke "add object dialog" on current tree item, or if not possible, try its parent */
function add_obj_dlg() {
if (holdContainer(firstSelectedItem())) addObjectDialog();
else if (holdContainer(firstSelectedItem().parent())) addObjectDialog(firstSelectedItem().parent().item());
}
/** Save page/selection as image */
function savePageImage(onlySelection) {
if (!PageSpace.saveImageWithDialog(onlySelection)) print(tr("Image was not saved!"));
}
/** Print to console and evaluate */
function print_eval(x) {
if (!x.length) return;
print("> "+x);
eval(x);
}
/** Set zoom level to x percent */
function zoom(x) {
PageSpace.zoomTo(x);
}
/** Go to page with number x in document. If parameter is empty, current page is reloaded */
function go(x) {
if (document.getPageCount()==0) {
print(tr("No pages in document"));
return;
}
if (x == undefined) {
tpage=page();
} else {
tpage=document.getPage(x);
}
csc=tpage.getContentStreamCount();
//flush all content streams
for(i=0;i<csc;i++) {
tpage.getContentStream(i).saveChange();
}
PageSpace.refresh(x,document);
}
/** Set icons to show that the mode 'newmode' is selected */
function activateMode(newMode) {
checkItem("streamAll",(newMode=='all'));
checkItem("streamText",(newMode=='text'));
checkItem("streamFont",(newMode=='font'));
checkItem("streamGfx",(newMode=='graphic'));
}
/** Set stream to certain mode */
function streamMode(newMode) {
x=treeRoot();
if (x.itemtype()!="ContentStream") return;
x.setMode(newMode);
activateMode(newMode);
}
/** Check if tree item holds a container (Array, Dict) */
function holdContainer(ti) {
type=ti.itemtype();
if (type=='Dict' || type=='Array') {
return true;
}
return false;
}
/** Delete all selected objects present in tree */
function deleteObjectsInTree() {
/*
Note:
deleting the object MAY change the selection in tree in the process,
so we need to store the objects first, then delete them all.
*/
victims=[];
treeItem=firstSelectedItem();
i=0;
while (treeItem) {
if (treeItem) {
victims[i]=treeItem;
i++;
}
treeItem=nextSelectedItem();
}
//We have them, now delete them all
for (i=0;i<victims.length;i++) {
victims[i].remove();
// print (victims[i].item().type());
}
//redraw the page
go();
}
|