0001: /*
0002: * Javu WingS - Lightweight Java Component Set
0003: * Copyright (c) 2005-2007 Krzysztof A. Sadlocha
0004: * e-mail: ksadlocha@programics.com
0005: *
0006: * This library is free software; you can redistribute it and/or
0007: * modify it under the terms of the GNU Lesser General Public
0008: * License as published by the Free Software Foundation; either
0009: * version 2.1 of the License, or (at your option) any later version.
0010: *
0011: * This library is distributed in the hope that it will be useful,
0012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014: * Lesser General Public License for more details.
0015: *
0016: * You should have received a copy of the GNU Lesser General Public
0017: * License along with this library; if not, write to the Free Software
0018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0019: */
0020:
0021: package com.javujavu.javux.demo;
0022:
0023: import java.awt.AWTEvent;
0024: import java.awt.BorderLayout;
0025: import java.awt.Component;
0026: import java.awt.Dimension;
0027: import java.awt.GridBagConstraints;
0028: import java.awt.GridBagLayout;
0029: import java.awt.Insets;
0030: import java.awt.event.ActionEvent;
0031: import java.awt.event.ActionListener;
0032: import java.awt.event.AdjustmentEvent;
0033: import java.awt.event.AdjustmentListener;
0034: import java.awt.event.ItemEvent;
0035: import java.awt.event.ItemListener;
0036: import java.awt.event.KeyEvent;
0037: import java.awt.event.TextEvent;
0038: import java.awt.event.TextListener;
0039: import java.util.Locale;
0040: import java.util.Vector;
0041: import com.javujavu.javux.wings.MenuRadioGroup;
0042: import com.javujavu.javux.wings.WingButton;
0043: import com.javujavu.javux.wings.WingCheckBox;
0044: import com.javujavu.javux.wings.WingCombo;
0045: import com.javujavu.javux.wings.WingComponent;
0046: import com.javujavu.javux.wings.WingLabel;
0047: import com.javujavu.javux.wings.WingMenu;
0048: import com.javujavu.javux.wings.WingMenuItem;
0049: import com.javujavu.javux.wings.WingPanel;
0050: import com.javujavu.javux.wings.WingScrollPane;
0051: import com.javujavu.javux.wings.WingSkin;
0052: import com.javujavu.javux.wings.WingSplitPane;
0053: import com.javujavu.javux.wings.WingTabbedPane;
0054: import com.javujavu.javux.wings.WingTextPane;
0055: import com.javujavu.javux.wings.dialogs.WingMessageBox;
0056: import com.javujavu.javux.wings.item.LabelItem;
0057: import com.javujavu.javux.wings.text.BoxNode;
0058: import com.javujavu.javux.wings.text.ImageNode;
0059:
0060: public class WingSetPanel extends WingPanel implements Runnable,
0061: ActionListener, ItemListener {
0062: private static String debugTab;//= "TextField;Spinner;Table";
0063: private static String initTab;//= "Menu";
0064: protected static WingSetPanel the;
0065:
0066: private WingMenu menu;
0067: private WingCombo cbSkin;
0068: private WingSplitPane split;
0069: private WingTabbedPane tabs;
0070: protected EventTracer eventTracer;
0071: private WingCheckBox cbSlideTab;
0072: private WingCheckBox cbSlideSkin;
0073: private Thread thread;
0074:
0075: private int slideFactor;
0076: private WingPanel showPanel;
0077:
0078: private WingMenuItem miSlideTab;
0079: private WingMenuItem miSlideSkin;
0080: private WingMenuItem miAbout;
0081: private Vector miSkin;
0082: private WingMenu mPanel;
0083: private MenuRadioGroup gPanel;
0084: private WingMenu mSkin;
0085:
0086: public WingSetPanel() {
0087: super (new BorderLayout());
0088:
0089: showPanel = new WingPanel(new BorderLayout());
0090: menu = new WingMenu(HORIZONTAL);
0091: WingMenu m;
0092: menu.add(m = new WingMenu("Slide Show"));
0093: m
0094: .add(miSlideTab = new WingMenuItem("Slide Show Tabs",
0095: CHECKBOX));
0096: m.add(miSlideSkin = new WingMenuItem("Slide Show Skins",
0097: CHECKBOX));
0098:
0099: WingPanel top = new WingPanel(new GridBagLayout());
0100: GridBagConstraints c = new GridBagConstraints();
0101: c.weightx = 1;
0102: c.anchor = GridBagConstraints.WEST;
0103: c.insets = new Insets(1, 1, 1, 1);
0104: top
0105: .add(new WingLabel(WingSkin.getImage("imgIcon", null,
0106: null)), c);
0107: c.weightx = 0;
0108: c.insets = new Insets(5, 5, 5, 5);
0109:
0110: top
0111: .add(cbSlideTab = new WingCheckBox("Slide Show Tabs",
0112: TOGGLE));
0113: top.add(cbSlideSkin = new WingCheckBox("Slide Show Skins",
0114: TOGGLE));
0115: top.add(new WingLabel("Skin: ", WingLabel.RIGHT), c);
0116: c.weightx = 1;
0117: c.anchor = GridBagConstraints.WEST;
0118: top.add(cbSkin = new WingCombo(), c);
0119:
0120: mSkin = new WingMenu("S\u0332kin", KeyEvent.VK_K,
0121: KeyEvent.ALT_MASK);
0122: MenuRadioGroup g = new MenuRadioGroup();
0123: miSkin = new Vector();
0124: for (int i = 0; i < WingSet.skins.size(); i++) {
0125: String skin = (String) WingSet.skins.elementAt(i);
0126: LabelItem li = new LabelItem(skin, WingSkin.getImage(
0127: "sample", skin, null));
0128: cbSkin.addItem(li);
0129: WingMenuItem mi;
0130: mSkin.add(mi = new WingMenuItem(li, RADIO));
0131: g.add(mi);
0132: miSkin.addElement(mi);
0133: if (i == WingSet.currentSkin) {
0134: mi.setSelected(true);
0135: }
0136: }
0137: menu.add(mSkin);
0138: cbSkin.setSelectedIndex(WingSet.currentSkin);
0139:
0140: menu.add(mPanel = new WingMenu("\u0332Panel", KeyEvent.VK_P,
0141: KeyEvent.ALT_MASK));
0142: gPanel = new MenuRadioGroup();
0143:
0144: showPanel.add(top, BorderLayout.NORTH);
0145:
0146: showPanel.add(split = new WingSplitPane(VERTICAL),
0147: BorderLayout.CENTER);
0148: split.setTopComponent(tabs = new WingTabbedPane());
0149: split.setResizeWeight(1);
0150:
0151: this .eventTracer = new EventTracer();
0152:
0153: this .add(showPanel);
0154:
0155: this .addActionListener(this );
0156: menu.addActionListener(this );
0157: this .addItemListener(this );
0158: menu.addItemListener(this );
0159:
0160: tabs
0161: .setTooltip(new LabelItem(
0162: "Tab navigation:\nCtrl+PageUp/Ctrl+PageDown - previous/next page\nRIGHT mouse button on tab bar opens quick menu",
0163: WingSet.imgBomb, LEFT, RIGHT));
0164:
0165: if (debugTab == null) {
0166: cbSlideTab.setSelected(true);
0167: cbSlideSkin.setSelected(!WingSet.isApplet
0168: || WingSet.isSkinExt);
0169: miSlideTab.setSelected(cbSlideTab.isSelected());
0170: miSlideSkin.setSelected(cbSlideSkin.isSelected());
0171: }
0172:
0173: the = this ;
0174: }
0175:
0176: public void removeSkin(int skinIndex) {
0177: cbSkin.removeItem(skinIndex);
0178: mSkin.removeItem((WingMenuItem) miSkin.elementAt(skinIndex));
0179: miSkin.removeElementAt(skinIndex);
0180: }
0181:
0182: private int addTab = 0;
0183:
0184: private boolean addNextTab() {
0185: switch (addTab++) {
0186: case 0:
0187: addTab(
0188: "Button",
0189: "Tab 'Button' demonstrates\n component of class WingButton",
0190: new WingScrollPane(new ButtonPanel(this ), false));
0191: break;
0192: case 1:
0193: addTab(
0194: "CheckBox",
0195: "Tab 'CheckBox' demonstrates\n component of class WingCheckBox\nand class RadioGroup",
0196: new WingScrollPane(new CheckBoxPanel(this ), false));
0197: break;
0198: case 2:
0199: addTab(
0200: "Combo",
0201: "Tab 'Combo' demonstrates\n component of class WingCombo",
0202: new WingScrollPane(new ComboPanel(this ), false));
0203: break;
0204: case 3:
0205: addTab(
0206: "Dialogs",
0207: "Tab 'Dialogs' demonstrates\n dialogs of class WingMessageBox",
0208: new WingScrollPane(new DialogsPanel(this ), false));
0209: break;
0210: case 4:
0211: addTab(
0212: "Image",
0213: "Tab 'Image' demonstrates component rendering\n using skin style sheet resources and class WingImage",
0214: new ImagePanel(this ));
0215: break;
0216: case 5:
0217: addTab(
0218: "List",
0219: "Tab 'List' demonstrates\n component of class WingList",
0220: new ListPanel(this ));
0221: break;
0222: case 6:
0223: WingScrollPane sp;
0224: addTab(
0225: "Menu",
0226: "Tab 'List' demonstrates\n components of class WingMenu and WingMenuItem\nand class MenuRadioGroup",
0227: sp = new WingScrollPane(new MenuPanel(this ), false));
0228: sp.setVerticalScrollBarPolicy(SCROLLBAR_NEVER);
0229: break;
0230: case 7:
0231: addTab(
0232: "Panel",
0233: "Tab 'Panel' demonstrates\n components of class WingPanel",
0234: new PanelPanel(this ));
0235: break;
0236: case 8:
0237: addTab(
0238: "Progress",
0239: "Tab 'Progress' demonstrates\n components of class WingProgress",
0240: new ProgressPanel(this ));
0241: break;
0242: case 9:
0243: addTab(
0244: "Scrollbar",
0245: "Tab 'Scrollbar' demonstrates\n components of class WingScroll and WingScrollPane",
0246: new ScrollbarPanel(this ));
0247: break;
0248: case 10:
0249: addTab(
0250: "Shortcut",
0251: "Tab 'Shortcut' demonstrates\n interactive keyboard shortcuts \nimplemented in class WingComponent",
0252: new WingScrollPane(new ShortcutPanel(this ), false));
0253: break;
0254: case 11:
0255: addTab(
0256: "Spinner",
0257: "Tab 'Spinner' demonstrates\n components of class WingSpinner",
0258: new WingScrollPane(new SpinnerPanel(this ), false));
0259: break;
0260: case 12:
0261: addTab(
0262: "SplitPane",
0263: "Tab 'SplitPane' demonstrates\n components of class WingSplitPane",
0264: new SplitPanePanel(this ));
0265: break;
0266: case 13:
0267: addTab(
0268: "TabbedPane",
0269: "Tab 'TabbedPane' demonstrates\n component of class WingTabbedPane",
0270: new TabbedPanePanel(this ));
0271: break;
0272: case 14:
0273: addTab(
0274: "Table",
0275: "Tab 'Table' demonstrates\n components of class WingTable",
0276: new TablePanel(this ));
0277: break;
0278: case 15:
0279: addTab(
0280: "TextPane",
0281: "Tab 'TextPane' demonstrates\n components of class WingTextPane and WingFont",
0282: new TextPanePanel(this ));
0283: break;
0284: case 16:
0285: addTab(
0286: "TextField",
0287: "Tab 'TextField' demonstrates\n components of class WingTextField",
0288: new WingScrollPane(new TextFieldPanel(this ), false));
0289: break;
0290: case 17:
0291: addTab(
0292: "Tooltip",
0293: "Tab 'Tooltip' demonstrates tooltips\nimplemented in class WingComponent",
0294: new TooltipPanel(this ));
0295: break;
0296: case 18:
0297: addTab(
0298: "Tree",
0299: "Tab 'Tree' demonstrates\n components of class WingTree",
0300: new TreePanel(this ));
0301: break;
0302: case 19:
0303: addTab(
0304: "ZOrder",
0305: "Tab 'ZOrder' demonstrates component Z-order\nimplemented in class WingComponent",
0306: new WingScrollPane(new ZOrderPanel(this ), false));
0307: break;
0308: case 20:
0309: addTab("Debug", "Debug options", new WingScrollPane(
0310: new DebugPanel(this ), false));
0311: break;
0312: default:
0313: return false;
0314: }
0315: return true;
0316: }
0317:
0318: private void addTab(String title, Object tooltip,
0319: WingComponent panel) {
0320: if (debugTab == null || debugTab.indexOf(title) != -1) {
0321: WingMenuItem mi;
0322: tabs.addTab(title, panel);
0323: tabs.setTooltipAt(tabs.getTabCount() - 1, tooltip);
0324: mPanel.add(mi = new WingMenuItem(title, RADIO));
0325: mi.setUserData(panel);
0326: gPanel.add(mi);
0327: getRootPane().addShortcuts(panel);
0328: getRootPane().addShortcuts(menu);
0329:
0330: if (initTab != null && initTab.equals(title)) {
0331: tabs.setSelectedIndex(tabs.getTabCount() - 1);
0332: mi.setSelected(true);
0333: }
0334: }
0335: }
0336:
0337: public void itemStateChanged(ItemEvent e) {
0338: Object src = e.getSource();
0339: if ((src == cbSkin && e.getStateChange() == ItemEvent.SELECTED)
0340: || src == cbSlideTab || src == cbSlideSkin
0341: || src == miSlideTab || src == miSlideSkin) {
0342: if (src == miSlideTab)
0343: cbSlideTab.setSelected(miSlideTab.isSelected());
0344: if (src == cbSlideTab)
0345: miSlideTab.setSelected(cbSlideTab.isSelected());
0346: if (src == miSlideSkin)
0347: cbSlideSkin.setSelected(miSlideSkin.isSelected());
0348: if (src == cbSlideSkin)
0349: miSlideSkin.setSelected(cbSlideSkin.isSelected());
0350:
0351: synchronized (this ) {
0352: this .notify();
0353: }
0354: } else if (src == tabs) {
0355: int i = tabs.getSelectedIndex();
0356: WingMenuItem mi = mPanel.getItem(i);
0357: mi.setSelected(true);
0358:
0359: eventTracer.clear();
0360: eventTracer.log(e);
0361: } else if (src instanceof WingMenuItem
0362: && ((WingMenuItem) src).getUserData() instanceof WingComponent) {
0363: tabs.setSelectedComponent((Component) ((WingMenuItem) src)
0364: .getUserData());
0365: } else if (miSkin.contains(src)) {
0366: cbSkin.setSelectedIndex(miSkin.indexOf(src));
0367:
0368: synchronized (this ) {
0369: this .notify();
0370: }
0371: } else
0372: eventTracer.log(e);
0373: }
0374:
0375: public void actionPerformed(ActionEvent e) {
0376: if (e.getSource() == miAbout)
0377: showAbout();
0378: else
0379: eventTracer.log(e);
0380: }
0381:
0382: void startThread() {
0383: thread = new Thread(this );
0384: thread.setDaemon(true);
0385: thread.start();
0386: }
0387:
0388: void stopThread() {
0389: thread = null;
0390: synchronized (this ) {
0391: this .notifyAll();
0392: }
0393: }
0394:
0395: public void run() {
0396: try {
0397: while (addNextTab())
0398: ;
0399:
0400: miAbout = menu.add("About");
0401:
0402: //skin slide thread
0403: while (thread == Thread.currentThread()) {
0404: boolean loadSkin = false;
0405: int selTab = -1;
0406: if (WingSet.currentSkin != cbSkin.getSelectedIndex()) {
0407: WingSet.currentSkin = cbSkin.getSelectedIndex();
0408: loadSkin = true;
0409: } else if (cbSlideTab.isSelected()) {
0410: if (cbSlideSkin.isSelected()) {
0411: slideFactor = (slideFactor + 1) % 4;
0412: if (slideFactor == 0)
0413: loadSkin = true;
0414: else
0415: selTab = (tabs.getSelectedIndex() + 1)
0416: % tabs.getTabCount();
0417: } else {
0418: selTab = (tabs.getSelectedIndex() + 1)
0419: % tabs.getTabCount();
0420: slideFactor = (slideFactor + 1) % 50;
0421: if (slideFactor == 0)
0422: loadSkin = true;
0423: }
0424: if (loadSkin)
0425: WingSet.currentSkin = (WingSet.currentSkin + 1)
0426: % WingSet.skins.size();
0427: } else if (cbSlideSkin.isSelected()) {
0428: WingSet.currentSkin = (WingSet.currentSkin + 1)
0429: % WingSet.skins.size();
0430: loadSkin = true;
0431: }
0432:
0433: if (selTab != -1) {
0434: tabs.setSelectedIndex(selTab);
0435: }
0436: if (WingSet.skins.size() == 1)
0437: loadSkin = false;
0438: if (loadSkin) {
0439: if (!WingSet.doLoadSkin(false)) {
0440: return;
0441: } else {
0442: cbSkin.setSelectedIndex(WingSet.currentSkin);
0443: ((WingMenuItem) miSkin
0444: .elementAt(WingSet.currentSkin))
0445: .setSelected(true);
0446: }
0447: }
0448: synchronized (this ) {
0449: if (loadSkin)
0450: this .wait(2500);
0451: else if (selTab != -1)
0452: this .wait(1000);
0453: else
0454: this .wait();
0455: }
0456: }
0457: } catch (InterruptedException e) {
0458: }
0459: }
0460:
0461: public void showEventLog(boolean show) {
0462: eventTracer.clear();
0463: eventTracer.setVisible(show);
0464: split.setBottomComponent((show) ? eventTracer : null);
0465: }
0466:
0467: protected class EventTracer extends WingPanel implements
0468: TextListener, AdjustmentListener {
0469: private WingTextPane ta;
0470: private int count;
0471: private WingButton bClear;
0472:
0473: EventTracer() {
0474: super (new BorderLayout());
0475: this .add(new WingScrollPane(ta = new WingTextPane()),
0476: BorderLayout.CENTER);
0477: this .add(bClear = new WingButton("Clear"),
0478: BorderLayout.EAST);
0479: this .setPreferredSize(new Dimension(100, 90));
0480: }
0481:
0482: public void wingProcessActionEvent(ActionEvent e) {
0483: if (e.getSource() == bClear)
0484: clear();
0485: }
0486:
0487: private void log(AWTEvent e) {
0488: count++;
0489: if (count > 99)
0490: clear();
0491: if (isVisible()) {
0492: ta.append("[" + count + "]" + e.toString() + " on "
0493: + Thread.currentThread() + "\n");
0494: ta.scrollToCaret();
0495: }
0496: }
0497:
0498: public void clear() {
0499: ta.setText("");
0500: count = 0;
0501: }
0502:
0503: public void textValueChanged(TextEvent e) {
0504: log(e);
0505: }
0506:
0507: public void adjustmentValueChanged(AdjustmentEvent e) {
0508: log(e);
0509: }
0510: }
0511:
0512: public void removeSkin() {
0513: WingSkin.removeAllSkins();
0514: WingComponent.updateSkin(WingSet.rootPane);
0515: WingComponent.updateSkin(showPanel);
0516: WingComponent.updateSkin(eventTracer);
0517:
0518: }
0519:
0520: public WingMenu getMenu() {
0521: return menu;
0522: }
0523:
0524: private void showAbout() {
0525: WingTextPane ta = new WingTextPane();
0526: ta.setStyleId("about");
0527: ta.setEditable(false);
0528:
0529: ta.insert(-1, new BoxNode(null, CENTER));
0530: ta.insert(-2, " WingSetDemo ", WingSkin.getStyle(null,
0531: "wingsetdemo.text3", null));
0532: ta.insert(-2, " Episode2007\n");
0533: ta.insert(-2, " Javu WingS\n", WingSkin.getStyle("green",
0534: "wingsetdemo.text3", null));
0535: ta.insert(-2, "Lightweight Java Component Set");
0536: ta.insert(-2, "\n\n");
0537: String s = Locale.getDefault().getLanguage();
0538: if (s != null && s.equals("pl"))
0539: s = "Sad\u0142ocha";
0540: else
0541: s = "Sadlocha";
0542: ta.insert(-2, new ImageNode(WingSet.imgGlasses, "8-)", null));
0543: ta.insert(-2, " Copyright (c) 2005-2007 Krzysztof " + s
0544: + "\n\n");
0545: ta.insert(-2, new ImageNode(WingSet.imgSmile, ":-)", null));
0546: ta.insert(-2,
0547: " Support: www.programics.com, www.javujavu.com\n");
0548: ta
0549: .insert(-2,
0550: " e-mail: ksadlocha@programics.com, ksadlocha@javujavu.com\n");
0551: ta.insert(-2, "\n\n\n");
0552: ta.insert(-2,
0553: "==================== License ====================");
0554: ta.insert(-2, "\n\n");
0555: ta.insert(-2, LICENSE);
0556: WingScrollPane sp = new WingScrollPane(ta);
0557: sp.setPreferredSize(new Dimension(500, 300));
0558: (new WingMessageBox(getParentFrame(), "WingSetDemo 2007", sp,
0559: "OK", null, null)).showMessage(the);
0560: }
0561:
0562: private static final String LICENSE = " GNU LESSER GENERAL PUBLIC LICENSE\n"
0563: + " Version 2.1, February 1999\n"
0564: + "\n"
0565: + " Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n"
0566: + " 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
0567: + " Everyone is permitted to copy and distribute verbatim copies\n"
0568: + " of this license document, but changing it is not allowed.\n"
0569: + "\n"
0570: + "[This is the first released version of the Lesser GPL. It also counts\n"
0571: + " as the successor of the GNU Library Public License, version 2, hence\n"
0572: + " the version number 2.1.]\n"
0573: + "\n"
0574: + " Preamble\n"
0575: + "\n"
0576: + " The licenses for most software are designed to take away your\n"
0577: + "freedom to share and change it. By contrast, the GNU General Public\n"
0578: + "Licenses are intended to guarantee your freedom to share and change\n"
0579: + "free software--to make sure the software is free for all its users.\n"
0580: + "\n"
0581: + " This license, the Lesser General Public License, applies to some\n"
0582: + "specially designated software packages--typically libraries--of the\n"
0583: + "Free Software Foundation and other authors who decide to use it. You\n"
0584: + "can use it too, but we suggest you first think carefully about whether\n"
0585: + "this license or the ordinary General Public License is the better\n"
0586: + "strategy to use in any particular case, based on the explanations below.\n"
0587: + "\n"
0588: + " When we speak of free software, we are referring to freedom of use,\n"
0589: + "not price. Our General Public Licenses are designed to make sure that\n"
0590: + "you have the freedom to distribute copies of free software (and charge\n"
0591: + "for this service if you wish); that you receive source code or can get\n"
0592: + "it if you want it; that you can change the software and use pieces of\n"
0593: + "it in new free programs; and that you are informed that you can do\n"
0594: + "these things.\n"
0595: + "\n"
0596: + " To protect your rights, we need to make restrictions that forbid\n"
0597: + "distributors to deny you these rights or to ask you to surrender these\n"
0598: + "rights. These restrictions translate to certain responsibilities for\n"
0599: + "you if you distribute copies of the library or if you modify it.\n"
0600: + "\n"
0601: + " For example, if you distribute copies of the library, whether gratis\n"
0602: + "or for a fee, you must give the recipients all the rights that we gave\n"
0603: + "you. You must make sure that they, too, receive or can get the source\n"
0604: + "code. If you link other code with the library, you must provide\n"
0605: + "complete object files to the recipients, so that they can relink them\n"
0606: + "with the library after making changes to the library and recompiling\n"
0607: + "it. And you must show them these terms so they know their rights.\n"
0608: + "\n"
0609: + " We protect your rights with a two-step method: (1) we copyright the\n"
0610: + "library, and (2) we offer you this license, which gives you legal\n"
0611: + "permission to copy, distribute and/or modify the library.\n"
0612: + "\n"
0613: + " To protect each distributor, we want to make it very clear that\n"
0614: + "there is no warranty for the free library. Also, if the library is\n"
0615: + "modified by someone else and passed on, the recipients should know\n"
0616: + "that what they have is not the original version, so that the original\n"
0617: + "author's reputation will not be affected by problems that might be\n"
0618: + "introduced by others.\n"
0619: + "\n"
0620: + " Finally, software patents pose a constant threat to the existence of\n"
0621: + "any free program. We wish to make sure that a company cannot\n"
0622: + "effectively restrict the users of a free program by obtaining a\n"
0623: + "restrictive license from a patent holder. Therefore, we insist that\n"
0624: + "any patent license obtained for a version of the library must be\n"
0625: + "consistent with the full freedom of use specified in this license.\n"
0626: + "\n"
0627: + " Most GNU software, including some libraries, is covered by the\n"
0628: + "ordinary GNU General Public License. This license, the GNU Lesser\n"
0629: + "General Public License, applies to certain designated libraries, and\n"
0630: + "is quite different from the ordinary General Public License. We use\n"
0631: + "this license for certain libraries in order to permit linking those\n"
0632: + "libraries into non-free programs.\n"
0633: + "\n"
0634: + " When a program is linked with a library, whether statically or using\n"
0635: + "a shared library, the combination of the two is legally speaking a\n"
0636: + "combined work, a derivative of the original library. The ordinary\n"
0637: + "General Public License therefore permits such linking only if the\n"
0638: + "entire combination fits its criteria of freedom. The Lesser General\n"
0639: + "Public License permits more lax criteria for linking other code with\n"
0640: + "the library.\n"
0641: + "\n"
0642: + " We call this license the \"Lesser\" General Public License because it\n"
0643: + "does Less to protect the user's freedom than the ordinary General\n"
0644: + "Public License. It also provides other free software developers Less\n"
0645: + "of an advantage over competing non-free programs. These disadvantages\n"
0646: + "are the reason we use the ordinary General Public License for many\n"
0647: + "libraries. However, the Lesser license provides advantages in certain\n"
0648: + "special circumstances.\n"
0649: + "\n"
0650: + " For example, on rare occasions, there may be a special need to\n"
0651: + "encourage the widest possible use of a certain library, so that it becomes\n"
0652: + "a de-facto standard. To achieve this, non-free programs must be\n"
0653: + "allowed to use the library. A more frequent case is that a free\n"
0654: + "library does the same job as widely used non-free libraries. In this\n"
0655: + "case, there is little to gain by limiting the free library to free\n"
0656: + "software only, so we use the Lesser General Public License.\n"
0657: + "\n"
0658: + " In other cases, permission to use a particular library in non-free\n"
0659: + "programs enables a greater number of people to use a large body of\n"
0660: + "free software. For example, permission to use the GNU C Library in\n"
0661: + "non-free programs enables many more people to use the whole GNU\n"
0662: + "operating system, as well as its variant, the GNU/Linux operating\n"
0663: + "system.\n"
0664: + "\n"
0665: + " Although the Lesser General Public License is Less protective of the\n"
0666: + "users' freedom, it does ensure that the user of a program that is\n"
0667: + "linked with the Library has the freedom and the wherewithal to run\n"
0668: + "that program using a modified version of the Library.\n"
0669: + "\n"
0670: + " The precise terms and conditions for copying, distribution and\n"
0671: + "modification follow. Pay close attention to the difference between a\n"
0672: + "\"work based on the library\" and a \"work that uses the library\". The\n"
0673: + "former contains code derived from the library, whereas the latter must\n"
0674: + "be combined with the library in order to run.\n"
0675: + "\n"
0676: + " GNU LESSER GENERAL PUBLIC LICENSE\n"
0677: + " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n"
0678: + "\n"
0679: + " 0. This License Agreement applies to any software library or other\n"
0680: + "program which contains a notice placed by the copyright holder or\n"
0681: + "other authorized party saying it may be distributed under the terms of\n"
0682: + "this Lesser General Public License (also called \"this License\").\n"
0683: + "Each licensee is addressed as \"you\".\n"
0684: + "\n"
0685: + " A \"library\" means a collection of software functions and/or data\n"
0686: + "prepared so as to be conveniently linked with application programs\n"
0687: + "(which use some of those functions and data) to form executables.\n"
0688: + "\n"
0689: + " The \"Library\", below, refers to any such software library or work\n"
0690: + "which has been distributed under these terms. A \"work based on the\n"
0691: + "Library\" means either the Library or any derivative work under\n"
0692: + "copyright law: that is to say, a work containing the Library or a\n"
0693: + "portion of it, either verbatim or with modifications and/or translated\n"
0694: + "straightforwardly into another language. (Hereinafter, translation is\n"
0695: + "included without limitation in the term \"modification\".)\n"
0696: + "\n"
0697: + " \"Source code\" for a work means the preferred form of the work for\n"
0698: + "making modifications to it. For a library, complete source code means\n"
0699: + "all the source code for all modules it contains, plus any associated\n"
0700: + "interface definition files, plus the scripts used to control compilation\n"
0701: + "and installation of the library.\n"
0702: + "\n"
0703: + " Activities other than copying, distribution and modification are not\n"
0704: + "covered by this License; they are outside its scope. The act of\n"
0705: + "running a program using the Library is not restricted, and output from\n"
0706: + "such a program is covered only if its contents constitute a work based\n"
0707: + "on the Library (independent of the use of the Library in a tool for\n"
0708: + "writing it). Whether that is true depends on what the Library does\n"
0709: + "and what the program that uses the Library does.\n"
0710: + " \n"
0711: + " 1. You may copy and distribute verbatim copies of the Library's\n"
0712: + "complete source code as you receive it, in any medium, provided that\n"
0713: + "you conspicuously and appropriately publish on each copy an\n"
0714: + "appropriate copyright notice and disclaimer of warranty; keep intact\n"
0715: + "all the notices that refer to this License and to the absence of any\n"
0716: + "warranty; and distribute a copy of this License along with the\n"
0717: + "Library.\n"
0718: + "\n"
0719: + " You may charge a fee for the physical act of transferring a copy,\n"
0720: + "and you may at your option offer warranty protection in exchange for a\n"
0721: + "fee.\n"
0722: + "\n"
0723: + " 2. You may modify your copy or copies of the Library or any portion\n"
0724: + "of it, thus forming a work based on the Library, and copy and\n"
0725: + "distribute such modifications or work under the terms of Section 1\n"
0726: + "above, provided that you also meet all of these conditions:\n"
0727: + "\n"
0728: + " a) The modified work must itself be a software library.\n"
0729: + "\n"
0730: + " b) You must cause the files modified to carry prominent notices\n"
0731: + " stating that you changed the files and the date of any change.\n"
0732: + "\n"
0733: + " c) You must cause the whole of the work to be licensed at no\n"
0734: + " charge to all third parties under the terms of this License.\n"
0735: + "\n"
0736: + " d) If a facility in the modified Library refers to a function or a\n"
0737: + " table of data to be supplied by an application program that uses\n"
0738: + " the facility, other than as an argument passed when the facility\n"
0739: + " is invoked, then you must make a good faith effort to ensure that,\n"
0740: + " in the event an application does not supply such function or\n"
0741: + " table, the facility still operates, and performs whatever part of\n"
0742: + " its purpose remains meaningful.\n"
0743: + "\n"
0744: + " (For example, a function in a library to compute square roots has\n"
0745: + " a purpose that is entirely well-defined independent of the\n"
0746: + " application. Therefore, Subsection 2d requires that any\n"
0747: + " application-supplied function or table used by this function must\n"
0748: + " be optional: if the application does not supply it, the square\n"
0749: + " root function must still compute square roots.)\n"
0750: + "\n"
0751: + "These requirements apply to the modified work as a whole. If\n"
0752: + "identifiable sections of that work are not derived from the Library,\n"
0753: + "and can be reasonably considered independent and separate works in\n"
0754: + "themselves, then this License, and its terms, do not apply to those\n"
0755: + "sections when you distribute them as separate works. But when you\n"
0756: + "distribute the same sections as part of a whole which is a work based\n"
0757: + "on the Library, the distribution of the whole must be on the terms of\n"
0758: + "this License, whose permissions for other licensees extend to the\n"
0759: + "entire whole, and thus to each and every part regardless of who wrote\n"
0760: + "it.\n"
0761: + "\n"
0762: + "Thus, it is not the intent of this section to claim rights or contest\n"
0763: + "your rights to work written entirely by you; rather, the intent is to\n"
0764: + "exercise the right to control the distribution of derivative or\n"
0765: + "collective works based on the Library.\n"
0766: + "\n"
0767: + "In addition, mere aggregation of another work not based on the Library\n"
0768: + "with the Library (or with a work based on the Library) on a volume of\n"
0769: + "a storage or distribution medium does not bring the other work under\n"
0770: + "the scope of this License.\n"
0771: + "\n"
0772: + " 3. You may opt to apply the terms of the ordinary GNU General Public\n"
0773: + "License instead of this License to a given copy of the Library. To do\n"
0774: + "this, you must alter all the notices that refer to this License, so\n"
0775: + "that they refer to the ordinary GNU General Public License, version 2,\n"
0776: + "instead of to this License. (If a newer version than version 2 of the\n"
0777: + "ordinary GNU General Public License has appeared, then you can specify\n"
0778: + "that version instead if you wish.) Do not make any other change in\n"
0779: + "these notices.\n"
0780: + "\n"
0781: + " Once this change is made in a given copy, it is irreversible for\n"
0782: + "that copy, so the ordinary GNU General Public License applies to all\n"
0783: + "subsequent copies and derivative works made from that copy.\n"
0784: + "\n"
0785: + " This option is useful when you wish to copy part of the code of\n"
0786: + "the Library into a program that is not a library.\n"
0787: + "\n"
0788: + " 4. You may copy and distribute the Library (or a portion or\n"
0789: + "derivative of it, under Section 2) in object code or executable form\n"
0790: + "under the terms of Sections 1 and 2 above provided that you accompany\n"
0791: + "it with the complete corresponding machine-readable source code, which\n"
0792: + "must be distributed under the terms of Sections 1 and 2 above on a\n"
0793: + "medium customarily used for software interchange.\n"
0794: + "\n"
0795: + " If distribution of object code is made by offering access to copy\n"
0796: + "from a designated place, then offering equivalent access to copy the\n"
0797: + "source code from the same place satisfies the requirement to\n"
0798: + "distribute the source code, even though third parties are not\n"
0799: + "compelled to copy the source along with the object code.\n"
0800: + "\n"
0801: + " 5. A program that contains no derivative of any portion of the\n"
0802: + "Library, but is designed to work with the Library by being compiled or\n"
0803: + "linked with it, is called a \"work that uses the Library\". Such a\n"
0804: + "work, in isolation, is not a derivative work of the Library, and\n"
0805: + "therefore falls outside the scope of this License.\n"
0806: + "\n"
0807: + " However, linking a \"work that uses the Library\" with the Library\n"
0808: + "creates an executable that is a derivative of the Library (because it\n"
0809: + "contains portions of the Library), rather than a \"work that uses the\n"
0810: + "library\". The executable is therefore covered by this License.\n"
0811: + "Section 6 states terms for distribution of such executables.\n"
0812: + "\n"
0813: + " When a \"work that uses the Library\" uses material from a header file\n"
0814: + "that is part of the Library, the object code for the work may be a\n"
0815: + "derivative work of the Library even though the source code is not.\n"
0816: + "Whether this is true is especially significant if the work can be\n"
0817: + "linked without the Library, or if the work is itself a library. The\n"
0818: + "threshold for this to be true is not precisely defined by law.\n"
0819: + "\n"
0820: + " If such an object file uses only numerical parameters, data\n"
0821: + "structure layouts and accessors, and small macros and small inline\n"
0822: + "functions (ten lines or less in length), then the use of the object\n"
0823: + "file is unrestricted, regardless of whether it is legally a derivative\n"
0824: + "work. (Executables containing this object code plus portions of the\n"
0825: + "Library will still fall under Section 6.)\n"
0826: + "\n"
0827: + " Otherwise, if the work is a derivative of the Library, you may\n"
0828: + "distribute the object code for the work under the terms of Section 6.\n"
0829: + "Any executables containing that work also fall under Section 6,\n"
0830: + "whether or not they are linked directly with the Library itself.\n"
0831: + "\n"
0832: + " 6. As an exception to the Sections above, you may also combine or\n"
0833: + "link a \"work that uses the Library\" with the Library to produce a\n"
0834: + "work containing portions of the Library, and distribute that work\n"
0835: + "under terms of your choice, provided that the terms permit\n"
0836: + "modification of the work for the customer's own use and reverse\n"
0837: + "engineering for debugging such modifications.\n"
0838: + "\n"
0839: + " You must give prominent notice with each copy of the work that the\n"
0840: + "Library is used in it and that the Library and its use are covered by\n"
0841: + "this License. You must supply a copy of this License. If the work\n"
0842: + "during execution displays copyright notices, you must include the\n"
0843: + "copyright notice for the Library among them, as well as a reference\n"
0844: + "directing the user to the copy of this License. Also, you must do one\n"
0845: + "of these things:\n"
0846: + "\n"
0847: + " a) Accompany the work with the complete corresponding\n"
0848: + " machine-readable source code for the Library including whatever\n"
0849: + " changes were used in the work (which must be distributed under\n"
0850: + " Sections 1 and 2 above); and, if the work is an executable linked\n"
0851: + " with the Library, with the complete machine-readable \"work that\n"
0852: + " uses the Library\", as object code and/or source code, so that the\n"
0853: + " user can modify the Library and then relink to produce a modified\n"
0854: + " executable containing the modified Library. (It is understood\n"
0855: + " that the user who changes the contents of definitions files in the\n"
0856: + " Library will not necessarily be able to recompile the application\n"
0857: + " to use the modified definitions.)\n"
0858: + "\n"
0859: + " b) Use a suitable shared library mechanism for linking with the\n"
0860: + " Library. A suitable mechanism is one that (1) uses at run time a\n"
0861: + " copy of the library already present on the user's computer system,\n"
0862: + " rather than copying library functions into the executable, and (2)\n"
0863: + " will operate properly with a modified version of the library, if\n"
0864: + " the user installs one, as long as the modified version is\n"
0865: + " interface-compatible with the version that the work was made with.\n"
0866: + "\n"
0867: + " c) Accompany the work with a written offer, valid for at\n"
0868: + " least three years, to give the same user the materials\n"
0869: + " specified in Subsection 6a, above, for a charge no more\n"
0870: + " than the cost of performing this distribution.\n"
0871: + "\n"
0872: + " d) If distribution of the work is made by offering access to copy\n"
0873: + " from a designated place, offer equivalent access to copy the above\n"
0874: + " specified materials from the same place.\n"
0875: + "\n"
0876: + " e) Verify that the user has already received a copy of these\n"
0877: + " materials or that you have already sent this user a copy.\n"
0878: + "\n"
0879: + " For an executable, the required form of the \"work that uses the\n"
0880: + "Library\" must include any data and utility programs needed for\n"
0881: + "reproducing the executable from it. However, as a special exception,\n"
0882: + "the materials to be distributed need not include anything that is\n"
0883: + "normally distributed (in either source or binary form) with the major\n"
0884: + "components (compiler, kernel, and so on) of the operating system on\n"
0885: + "which the executable runs, unless that component itself accompanies\n"
0886: + "the executable.\n"
0887: + "\n"
0888: + " It may happen that this requirement contradicts the license\n"
0889: + "restrictions of other proprietary libraries that do not normally\n"
0890: + "accompany the operating system. Such a contradiction means you cannot\n"
0891: + "use both them and the Library together in an executable that you\n"
0892: + "distribute.\n"
0893: + "\n"
0894: + " 7. You may place library facilities that are a work based on the\n"
0895: + "Library side-by-side in a single library together with other library\n"
0896: + "facilities not covered by this License, and distribute such a combined\n"
0897: + "library, provided that the separate distribution of the work based on\n"
0898: + "the Library and of the other library facilities is otherwise\n"
0899: + "permitted, and provided that you do these two things:\n"
0900: + "\n"
0901: + " a) Accompany the combined library with a copy of the same work\n"
0902: + " based on the Library, uncombined with any other library\n"
0903: + " facilities. This must be distributed under the terms of the\n"
0904: + " Sections above.\n"
0905: + "\n"
0906: + " b) Give prominent notice with the combined library of the fact\n"
0907: + " that part of it is a work based on the Library, and explaining\n"
0908: + " where to find the accompanying uncombined form of the same work.\n"
0909: + "\n"
0910: + " 8. You may not copy, modify, sublicense, link with, or distribute\n"
0911: + "the Library except as expressly provided under this License. Any\n"
0912: + "attempt otherwise to copy, modify, sublicense, link with, or\n"
0913: + "distribute the Library is void, and will automatically terminate your\n"
0914: + "rights under this License. However, parties who have received copies,\n"
0915: + "or rights, from you under this License will not have their licenses\n"
0916: + "terminated so long as such parties remain in full compliance.\n"
0917: + "\n"
0918: + " 9. You are not required to accept this License, since you have not\n"
0919: + "signed it. However, nothing else grants you permission to modify or\n"
0920: + "distribute the Library or its derivative works. These actions are\n"
0921: + "prohibited by law if you do not accept this License. Therefore, by\n"
0922: + "modifying or distributing the Library (or any work based on the\n"
0923: + "Library), you indicate your acceptance of this License to do so, and\n"
0924: + "all its terms and conditions for copying, distributing or modifying\n"
0925: + "the Library or works based on it.\n"
0926: + "\n"
0927: + " 10. Each time you redistribute the Library (or any work based on the\n"
0928: + "Library), the recipient automatically receives a license from the\n"
0929: + "original licensor to copy, distribute, link with or modify the Library\n"
0930: + "subject to these terms and conditions. You may not impose any further\n"
0931: + "restrictions on the recipients' exercise of the rights granted herein.\n"
0932: + "You are not responsible for enforcing compliance by third parties with\n"
0933: + "this License.\n"
0934: + "\n"
0935: + " 11. If, as a consequence of a court judgment or allegation of patent\n"
0936: + "infringement or for any other reason (not limited to patent issues),\n"
0937: + "conditions are imposed on you (whether by court order, agreement or\n"
0938: + "otherwise) that contradict the conditions of this License, they do not\n"
0939: + "excuse you from the conditions of this License. If you cannot\n"
0940: + "distribute so as to satisfy simultaneously your obligations under this\n"
0941: + "License and any other pertinent obligations, then as a consequence you\n"
0942: + "may not distribute the Library at all. For example, if a patent\n"
0943: + "license would not permit royalty-free redistribution of the Library by\n"
0944: + "all those who receive copies directly or indirectly through you, then\n"
0945: + "the only way you could satisfy both it and this License would be to\n"
0946: + "refrain entirely from distribution of the Library.\n"
0947: + "\n"
0948: + "If any portion of this section is held invalid or unenforceable under any\n"
0949: + "particular circumstance, the balance of the section is intended to apply,\n"
0950: + "and the section as a whole is intended to apply in other circumstances.\n"
0951: + "\n"
0952: + "It is not the purpose of this section to induce you to infringe any\n"
0953: + "patents or other property right claims or to contest validity of any\n"
0954: + "such claims; this section has the sole purpose of protecting the\n"
0955: + "integrity of the free software distribution system which is\n"
0956: + "implemented by public license practices. Many people have made\n"
0957: + "generous contributions to the wide range of software distributed\n"
0958: + "through that system in reliance on consistent application of that\n"
0959: + "system; it is up to the author/donor to decide if he or she is willing\n"
0960: + "to distribute software through any other system and a licensee cannot\n"
0961: + "impose that choice.\n"
0962: + "\n"
0963: + "This section is intended to make thoroughly clear what is believed to\n"
0964: + "be a consequence of the rest of this License.\n"
0965: + "\n"
0966: + " 12. If the distribution and/or use of the Library is restricted in\n"
0967: + "certain countries either by patents or by copyrighted interfaces, the\n"
0968: + "original copyright holder who places the Library under this License may add\n"
0969: + "an explicit geographical distribution limitation excluding those countries,\n"
0970: + "so that distribution is permitted only in or among countries not thus\n"
0971: + "excluded. In such case, this License incorporates the limitation as if\n"
0972: + "written in the body of this License.\n"
0973: + "\n"
0974: + " 13. The Free Software Foundation may publish revised and/or new\n"
0975: + "versions of the Lesser General Public License from time to time.\n"
0976: + "Such new versions will be similar in spirit to the present version,\n"
0977: + "but may differ in detail to address new problems or concerns.\n"
0978: + "\n"
0979: + "Each version is given a distinguishing version number. If the Library\n"
0980: + "specifies a version number of this License which applies to it and\n"
0981: + "\"any later version\", you have the option of following the terms and\n"
0982: + "conditions either of that version or of any later version published by\n"
0983: + "the Free Software Foundation. If the Library does not specify a\n"
0984: + "license version number, you may choose any version ever published by\n"
0985: + "the Free Software Foundation.\n"
0986: + "\n"
0987: + " 14. If you wish to incorporate parts of the Library into other free\n"
0988: + "programs whose distribution conditions are incompatible with these,\n"
0989: + "write to the author to ask for permission. For software which is\n"
0990: + "copyrighted by the Free Software Foundation, write to the Free\n"
0991: + "Software Foundation; we sometimes make exceptions for this. Our\n"
0992: + "decision will be guided by the two goals of preserving the free status\n"
0993: + "of all derivatives of our free software and of promoting the sharing\n"
0994: + "and reuse of software generally.\n"
0995: + "\n"
0996: + " NO WARRANTY\n"
0997: + "\n"
0998: + " 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\n"
0999: + "WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\n"
1000: + "EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\n"
1001: + "OTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\n"
1002: + "KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\n"
1003: + "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n"
1004: + "PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\n"
1005: + "LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\n"
1006: + "THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n"
1007: + "\n"
1008: + " 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\n"
1009: + "WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\n"
1010: + "AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\n"
1011: + "FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\n"
1012: + "CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\n"
1013: + "LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\n"
1014: + "RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\n"
1015: + "FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\n"
1016: + "SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\n"
1017: + "DAMAGES.\n"
1018: + "\n"
1019: + " END OF TERMS AND CONDITIONS\n"
1020: + "\n";
1021:
1022: }
|