private void createUI24SmoothPulse(final Composite parent) {

    /*
     * image: pulse
     */
    _iconPulse = new CLabel(parent, SWT.NONE);
    GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconPulse);
    _iconPulse.setBackground(_tk.getColors().getBackground());
    _iconPulse.setImage(_imagePulse);

    /*
     * checkbox: smooth speed
     */
    _chkIsPulseSmoothing =
        _tk.createButton(parent, Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing, SWT.CHECK);
    GridDataFactory.fillDefaults() //
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(_chkIsPulseSmoothing);
    _chkIsPulseSmoothing.addSelectionListener(_selectionListener);
    _chkIsPulseSmoothing.setToolTipText(
        Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing_Tooltip);

    /*
     * spinner: speed tau
     */
    _spinnerPulseTau = new Spinner(parent, SWT.BORDER);
    GridDataFactory.fillDefaults() //
        .align(SWT.BEGINNING, SWT.FILL)
        .applyTo(_spinnerPulseTau);
    _spinnerPulseTau.setDigits(1);
    _spinnerPulseTau.setMinimum(1);
    _spinnerPulseTau.setMaximum(MAX_TAU);
    _spinnerPulseTau.addSelectionListener(_selectionListener);
    _spinnerPulseTau.addMouseWheelListener(_spinnerMouseWheelListener);
  }
  private void createUI22SmoothGradient(final Composite parent) {

    /*
     * image: gradient
     */
    _iconGradient = new CLabel(parent, SWT.NONE);
    GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconGradient);
    _iconGradient.setBackground(_tk.getColors().getBackground());
    _iconGradient.setImage(_imageGradient);

    /*
     * label: smooth gradient
     */
    final Label label =
        _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_GradientSmoothing, SWT.CHECK);
    GridDataFactory.fillDefaults() //
        .align(SWT.FILL, SWT.CENTER)
        .applyTo(label);
    label.setToolTipText(Messages.TourChart_Smoothing_Label_GradientSmoothing_Tooltip);

    /*
     * spinner: gradient tau
     */
    _spinnerGradientTau = new Spinner(parent, SWT.BORDER);
    GridDataFactory.fillDefaults() //
        .align(SWT.BEGINNING, SWT.FILL)
        .applyTo(_spinnerGradientTau);
    _spinnerGradientTau.setDigits(1);
    _spinnerGradientTau.setMinimum(1);
    _spinnerGradientTau.setMaximum(MAX_TAU);
    _spinnerGradientTau.addSelectionListener(_selectionListener);
    _spinnerGradientTau.addMouseWheelListener(_spinnerMouseWheelListener);
  }
 private CLabel createLabel(Composite parent, String text, Control control) {
   CLabel label = new CLabel(parent, SWT.NONE);
   label.setText(text);
   FormData data = new FormData();
   data.left = new FormAttachment(0, 0);
   data.right = new FormAttachment(control, -HSPACE);
   data.top = new FormAttachment(control, 0, SWT.TOP);
   label.setLayoutData(data);
   label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
   return label;
 }
 /** This method initializes treeViewcomposite. */
 private void createTreeViewcomposite() {
   GridData gridData5 = new GridData();
   gridData5.horizontalAlignment = GridData.FILL;
   gridData5.verticalAlignment = GridData.CENTER;
   GridData gridData4 = new GridData();
   gridData4.horizontalAlignment = GridData.FILL;
   gridData4.verticalAlignment = GridData.CENTER;
   GridLayout gridLayout = new GridLayout();
   gridLayout.numColumns = 2;
   treeViewcomposite = new Composite(cTabFolder, SWT.NONE);
   treeViewcomposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
   createModelFilteredTree();
   treeViewcomposite.setLayout(gridLayout);
   newDiagrambutton = new Button(treeViewcomposite, SWT.NONE);
   newDiagrambutton.setText(Messages.AbstractLookForEditorShell_New);
   newDiagrambutton.setLayoutData(gridData4);
   removeDiagrambutton = new Button(treeViewcomposite, SWT.NONE);
   removeDiagrambutton.setText(Messages.AbstractLookForEditorShell_Remove);
   removeDiagrambutton.setLayoutData(gridData5);
   cLabel = new CLabel(treeViewcomposite, SWT.NONE);
   cLabel.setText("   "); // $NON-NLS-1$
   cLabel.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
 }
  private void createUI26SmoothAltitude(final Composite parent) {

    /*
     * image: altitude
     */
    _iconAltitude = new CLabel(parent, SWT.NONE);
    GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconAltitude);
    _iconAltitude.setBackground(_tk.getColors().getBackground());
    _iconAltitude.setImage(_imageAltitude);

    /*
     * checkbox: smooth altitude
     */
    _chkIsAltitudeSmoothing =
        _tk.createButton(
            parent, Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing, SWT.CHECK);
    GridDataFactory.fillDefaults() //
        .align(SWT.FILL, SWT.CENTER)
        .span(2, 1)
        .applyTo(_chkIsAltitudeSmoothing);
    _chkIsAltitudeSmoothing.setToolTipText(
        Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing_Tooltip);
    _chkIsAltitudeSmoothing.addSelectionListener(_selectionListener);
  }
Exemple #6
0
  @Override
  public void createPartControl(Composite parent) {

    logger.logInfo("Starting flight data view...", this.getClass());

    sensorData = new Group(parent, SWT.NONE);
    sensorData.setLayout(new GridLayout(1, false));
    GridData layoutData = new GridData();
    layoutData.horizontalSpan = 1;
    layoutData.grabExcessVerticalSpace = true;
    sensorData.setLayoutData(layoutData);
    sensorData.setText("Flight Data");

    GridData layoutGradient = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    layoutGradient.widthHint = 40;
    layoutGradient.heightHint = 15;
    layoutGradient.horizontalSpan = 1;

    GridData layoutSensor = new GridData();
    layoutSensor.minimumWidth = 20;
    layoutSensor.widthHint = 50;

    GridData layoutMotor = new GridData();
    layoutMotor.minimumWidth = 20;
    layoutMotor.widthHint = 30;

    GridData layoutLabelAttitude = new GridData();
    layoutLabelAttitude.minimumWidth = 20;
    layoutLabelAttitude.widthHint = 50;

    GridData layoutLabelS = new GridData();
    layoutLabelS.minimumWidth = 20;
    layoutLabelS.widthHint = 30;

    GridData layoutLabel = new GridData();
    layoutLabel.minimumWidth = 20;
    layoutLabel.widthHint = 50;

    Group angleData = new Group(sensorData, SWT.NONE);
    angleData.setLayout(new GridLayout(4, true));
    angleData.setText("Attitude Angles (°)");
    angleData.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label label = new Label(angleData, SWT.NONE);
    label.setText("Roll: ");
    label.setLayoutData(layoutLabelAttitude);
    rollText = new Text(angleData, SWT.NONE);
    rollText.setEnabled(false);
    rollText.setLayoutData(layoutSensor);
    rollText.setText("0.0");

    label = new Label(angleData, SWT.NONE);
    label.setText("Pitch: ");
    label.setLayoutData(layoutLabelAttitude);
    pitchText = new Text(angleData, SWT.NONE);
    pitchText.setEnabled(false);
    pitchText.setLayoutData(layoutSensor);
    pitchText.setText("0.0");

    label = new Label(angleData, SWT.NONE);
    label.setText("Heading: ");
    label.setLayoutData(layoutLabelAttitude);
    headingText = new Text(angleData, SWT.NONE);
    headingText.setEnabled(false);
    headingText.setLayoutData(layoutSensor);
    headingText.setText("0.0");

    Group dof1Data = new Group(sensorData, SWT.NONE);
    dof1Data.setLayout(new GridLayout(6, false));
    dof1Data.setText("Acceleration (g)");
    dof1Data.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(dof1Data, SWT.NONE);
    label.setText("x: ");
    label.setLayoutData(layoutLabelS);
    accXText = new Text(dof1Data, SWT.NONE);
    accXText.setEnabled(false);
    accXText.setLayoutData(layoutSensor);
    accXText.setText("0.0");

    label = new Label(dof1Data, SWT.NONE);
    label.setText("y: ");
    label.setLayoutData(layoutLabelS);
    accYText = new Text(dof1Data, SWT.NONE);
    accYText.setEnabled(false);
    accYText.setLayoutData(layoutSensor);
    accYText.setText("0.0");

    label = new Label(dof1Data, SWT.NONE);
    label.setText("z: ");
    label.setLayoutData(layoutLabelS);
    accZText = new Text(dof1Data, SWT.NONE);
    accZText.setEnabled(false);
    accZText.setLayoutData(layoutSensor);
    accZText.setText("0.0");

    Group dof2Data = new Group(sensorData, SWT.NONE);
    dof2Data.setLayout(new GridLayout(6, false));
    dof2Data.setText("Angular Velocity (°/s)");
    dof2Data.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(dof2Data, SWT.NONE);
    label.setText("x: ");
    label.setLayoutData(layoutLabelS);
    awXText = new Text(dof2Data, SWT.NONE);
    awXText.setEnabled(false);
    awXText.setLayoutData(layoutSensor);
    awXText.setText("0.0");

    label = new Label(dof2Data, SWT.NONE);
    label.setText("y: ");
    label.setLayoutData(layoutLabelS);
    awYText = new Text(dof2Data, SWT.NONE);
    awYText.setEnabled(false);
    awYText.setLayoutData(layoutSensor);
    awYText.setText("0.0");

    label = new Label(dof2Data, SWT.NONE);
    label.setText("z: ");
    label.setLayoutData(layoutLabelS);
    awZText = new Text(dof2Data, SWT.NONE);
    awZText.setEnabled(false);
    awZText.setLayoutData(layoutSensor);
    awZText.setText("0.0");

    Group dof3Data = new Group(sensorData, SWT.NONE);
    dof3Data.setLayout(new GridLayout(6, false));
    dof3Data.setText("Magnetic Field (uGauss)");
    dof3Data.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    label = new Label(dof3Data, SWT.NONE);
    label.setText("x: ");
    label.setLayoutData(layoutLabelS);
    magXText = new Text(dof3Data, SWT.NONE);
    magXText.setEnabled(false);
    magXText.setLayoutData(layoutSensor);
    magXText.setText("0.0");

    label = new Label(dof3Data, SWT.NONE);
    label.setText("y: ");
    label.setLayoutData(layoutLabelS);
    magYText = new Text(dof3Data, SWT.NONE);
    magYText.setEnabled(false);
    magYText.setLayoutData(layoutSensor);
    magYText.setText("0.0");

    label = new Label(dof3Data, SWT.NONE);
    label.setText("z: ");
    label.setLayoutData(layoutLabelS);
    magZText = new Text(dof3Data, SWT.NONE);
    magZText.setEnabled(false);
    magZText.setLayoutData(layoutSensor);
    magZText.setText("0.0");

    Group control = new Group(sensorData, SWT.NONE);
    control.setLayout(new GridLayout(6, false));
    layoutData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    layoutData.horizontalSpan = 6;
    control.setLayoutData(layoutData);
    control.setText("Motors Speed");

    label = new Label(control, SWT.NONE);
    label.setText("Front (R): ");
    label.setLayoutData(layoutLabel);

    gM0 = new CLabel(control, SWT.SHADOW_IN);
    gM0.setLayoutData(layoutGradient);
    gM0.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m0Text = new Text(control, SWT.NONE);
    m0Text.setEnabled(false);
    m0Text.setLayoutData(layoutMotor);
    m0Text.setText("0.0");

    label = new Label(control, SWT.NONE);
    label.setText("Front (L): ");
    label.setLayoutData(layoutLabel);

    gM1 = new CLabel(control, SWT.SHADOW_IN);
    gM1.setLayoutData(layoutGradient);
    gM1.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m1Text = new Text(control, SWT.NONE);
    m1Text.setEnabled(false);
    m1Text.setLayoutData(layoutMotor);
    m1Text.setText("0.0");

    label = new Label(control, SWT.NONE);
    label.setText("Back (R): ");
    label.setLayoutData(layoutLabel);

    gM2 = new CLabel(control, SWT.SHADOW_IN);
    gM2.setLayoutData(layoutGradient);
    gM2.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m2Text = new Text(control, SWT.NONE);
    m2Text.setEnabled(false);
    m2Text.setLayoutData(layoutMotor);
    m2Text.setText("0.0");

    label = new Label(control, SWT.NONE);
    label.setText("Back (L): ");
    label.setLayoutData(layoutLabel);

    gM3 = new CLabel(control, SWT.SHADOW_IN);
    gM3.setLayoutData(layoutGradient);
    gM3.setBackground(
        new Color[] {
          Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
          Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
          Display.getDefault().getSystemColor(SWT.COLOR_RED)
        },
        new int[] {100, 100});
    m3Text = new Text(control, SWT.NONE);
    m3Text.setEnabled(false);
    m3Text.setLayoutData(layoutMotor);
    m3Text.setText("0.0");
  }
Exemple #7
0
  public static void updateFlight() {
    try {
      if (!sensorData.isDisposed() && sensorData.isVisible()) {
        rollText.setText(String.format("%3.3f", rpy.getRoll()));
        pitchText.setText(String.format("%3.3f", rpy.getPitch()));
        headingText.setText(String.format("%3.3f", rpy.getHeading()));

        accXText.setText(String.format("%3.3f", rpy.getAccX()));
        accYText.setText(String.format("%3.3f", rpy.getAccY()));
        accZText.setText(String.format("%3.3f", rpy.getAccZ()));

        awXText.setText(String.format("%3.3f", rpy.getGyroX()));
        awYText.setText(String.format("%3.3f", rpy.getGyroY()));
        awZText.setText(String.format("%3.3f", rpy.getGyroZ()));

        magXText.setText(String.format("%3.3f", rpy.getMagX()));
        magYText.setText(String.format("%3.3f", rpy.getMagY()));
        magZText.setText(String.format("%3.3f", rpy.getMagZ()));

        if (rpy.getM3() <= 100 && rpy.getM3() >= 0) {
          gM1.setBackground(
              new Color[] {
                Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
                Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
                Display.getDefault().getSystemColor(SWT.COLOR_RED)
              },
              new int[] {(int) (100 - rpy.getM3()), 100});
          m1Text.setText(String.format("%3.1f", rpy.getM3()));
          gM1.layout();
        }

        if (rpy.getM2() <= 100 && rpy.getM2() >= 0) {
          gM0.setBackground(
              new Color[] {
                Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
                Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
                Display.getDefault().getSystemColor(SWT.COLOR_RED)
              },
              new int[] {(int) (100 - rpy.getM2()), 100});
          m0Text.setText(String.format("%3.1f", rpy.getM2()));
          gM0.layout();
        }

        if (rpy.getM0() <= 100 && rpy.getM0() >= 0) {
          gM3.setBackground(
              new Color[] {
                Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
                Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
                Display.getDefault().getSystemColor(SWT.COLOR_RED)
              },
              new int[] {(int) (100 - rpy.getM0()), 100});
          m3Text.setText(String.format("%3.1f", rpy.getM0()));
          gM3.layout();
        }

        if (rpy.getM1() <= 100 && rpy.getM1() >= 0) {
          gM2.setBackground(
              new Color[] {
                Display.getDefault().getSystemColor(SWT.COLOR_GREEN),
                Display.getDefault().getSystemColor(SWT.COLOR_YELLOW),
                Display.getDefault().getSystemColor(SWT.COLOR_RED)
              },
              new int[] {(int) (100 - rpy.getM1()), 100});
          m2Text.setText(String.format("%3.1f", rpy.getM1()));
          gM2.layout();
        }
      }
    } catch (Exception e) {
    }
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite theParent) {
    originalLanguageObjLabel =
        WidgetFactory.createLabel(theParent, CoreStringUtil.Constants.EMPTY_STRING);
    Composite pnlContents = (Composite) super.createDialogArea(theParent);

    //
    // main panel contents
    //

    CTabFolder tabFolder = WidgetFactory.createTabFolder(pnlContents);

    //
    // tabFolder contents - 2 tabs (Tree, SQL Text), each with a splitter
    //

    CTabItem treeTab =
        WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "treeTab")); // $NON-NLS-1$
    treeTab.setToolTipText(Util.getString(PREFIX + "treeTab.tip")); // $NON-NLS-1$

    SashForm treeTabSash = new SashForm(tabFolder, SWT.VERTICAL);
    treeTabSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    treeTab.setControl(treeTabSash);

    CTabItem sqlTab =
        WidgetFactory.createTab(tabFolder, Util.getString(PREFIX + "sqlTab")); // $NON-NLS-1$
    sqlTab.setToolTipText(Util.getString(PREFIX + "sqlTab.tip")); // $NON-NLS-1$

    SashForm sqlTabSash = new SashForm(tabFolder, SWT.VERTICAL);
    sqlTabSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    sqlTab.setControl(sqlTabSash);

    //
    // treeTab contents
    //

    ViewForm formTree = new ViewForm(treeTabSash, SWT.BORDER);
    Composite pnlTree = new Composite(formTree, SWT.NO_TRIM);
    formTree.setContent(pnlTree);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    pnlTree.setLayout(layout);
    pnlTree.setLayoutData(new GridData(GridData.FILL_BOTH));

    ViewForm formEditor = new ViewForm(treeTabSash, SWT.BORDER);
    pnlEditor = new Composite(formEditor, SWT.NO_TRIM);
    formEditor.setContent(pnlEditor);
    pnlEditor.setLayoutData(new GridData(GridData.FILL_BOTH));

    lblTitle = new Label(formEditor, SWT.CENTER);
    lblTitle.setBackground(BuilderUtils.COLOR_HIGHLIGHT);
    formEditor.setTopLeft(lblTitle);

    treeTabSash.setWeights(new int[] {30, 70});

    //
    // sqlTab contents
    //

    ViewForm formCurrentSql = new ViewForm(sqlTabSash, SWT.BORDER);
    ViewForm formOriginalSql = new ViewForm(sqlTabSash, SWT.BORDER);

    //
    // formCurrentSql contents
    //

    Composite pnlCurrentSql = new Composite(formCurrentSql, SWT.NONE);
    formCurrentSql.setContent(pnlCurrentSql);
    pnlCurrentSql.setLayout(new GridLayout());
    pnlCurrentSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    currentSql = new SqlDisplayPanel(pnlCurrentSql);
    currentSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    CLabel lblCurrent = new CLabel(formCurrentSql, SWT.NONE);
    lblCurrent.setBackground(BuilderUtils.COLOR_HIGHLIGHT);
    lblCurrent.setText(Util.getString(PREFIX + "lblCurrent")); // $NON-NLS-1$
    lblCurrent.setToolTipText(Util.getString(PREFIX + "lblCurrent.tip")); // $NON-NLS-1$
    formCurrentSql.setTopLeft(lblCurrent);

    //
    // formOriginalSql contents
    //

    Composite pnlOriginalSql = new Composite(formOriginalSql, SWT.NONE);
    formOriginalSql.setContent(pnlOriginalSql);
    pnlOriginalSql.setLayout(new GridLayout());
    pnlOriginalSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    originalSql = new SqlDisplayPanel(pnlOriginalSql);
    originalSql.setLayoutData(new GridData(GridData.FILL_BOTH));

    CLabel lblOriginal = new CLabel(formOriginalSql, SWT.NONE);
    lblOriginal.setBackground(BuilderUtils.COLOR_HIGHLIGHT);
    lblOriginal.setText(Util.getString(PREFIX + "lblOriginal")); // $NON-NLS-1$
    lblOriginal.setToolTipText(Util.getString(PREFIX + "lblOriginal.tip")); // $NON-NLS-1$
    formOriginalSql.setTopLeft(lblOriginal);

    //
    // pnlTree contents - 2 columns (tree viewer, button panel)
    //

    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    pnlTree.setLayout(layout);

    treeViewer = new LanguageObjectBuilderTreeViewer(pnlTree);
    treeViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
          @Override
          public void selectionChanged(SelectionChangedEvent theEvent) {
            handleTreeSelection();
          }
        });

    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(
        new IMenuListener() {
          @Override
          public void menuAboutToShow(IMenuManager theMenuMgr) {
            fillContextMenu(theMenuMgr);
          }
        });
    treeViewer.getTree().setMenu(menuMgr.createContextMenu(treeViewer.getTree()));

    Composite pnlButtons = new Composite(pnlTree, SWT.NONE);
    pnlButtons.setLayout(new GridLayout());

    createTreeButtons(pnlButtons);

    //
    // pnlEditor contents
    //

    layout = new GridLayout();
    layout.numColumns = 2;
    pnlEditor.setLayout(layout);

    pnlEditorDetail = new Composite(pnlEditor, SWT.NONE);
    pnlEditorDetail.setLayoutData(new GridData(GridData.FILL_BOTH));
    pnlEditorDetail.setLayout(new GridLayout());
    return pnlContents;
  }
    public Composite createControls(Composite parent) {
      setPreferenceKey("mp3converttab");

      // set default for preferences.
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "quickcopy", true);
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "forceconvert", false);

      getPreferenceStore().setDefault(getPreferenceKey() + "." + "audioBitrate", "128");
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "useAvisynth", false);

      Composite composite = new Composite(parent, SWT.NULL);
      composite.setLayout(new GridLayout(1, true));

      Group exportDir = new Group(composite, SWT.NULL);
      exportDir.setToolTipText(Messages.getString("mp3convert.exportDir.tooltip"));
      exportDir.setLayout(new GridLayout());
      exportDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      exportDir.setText(Messages.getString("mp3convert.exportDir"));

      createDirectoryInfo(exportDir);

      Group detailSetting = new Group(composite, SWT.NULL);
      detailSetting.setLayout(new FillLayout());
      detailSetting.setLayoutData(new GridData(GridData.FILL_BOTH));
      detailSetting.setText(Messages.getString("mp3convert.detail"));

      ExpandBar bar = new ExpandBar(detailSetting, SWT.V_SCROLL);

      Composite copybase = new Composite(bar, SWT.NULL);
      copybase.setLayout(new RowLayout());
      quickCopy = new Button(copybase, SWT.CHECK);
      quickCopy.setText(Messages.getString("mp3convert.quickcopy"));
      quickCopy.addSelectionListener(
          new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {}

            public void widgetSelected(SelectionEvent e) {
              updateStatus();
            }
          });
      // quickCopy.setSelection(true);//

      ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
      item0.setText(Messages.getString("mp3convert.aboutcopy"));
      item0.setHeight(copybase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item0.setControl(copybase);

      Composite advancedSetting = new Composite(bar, SWT.NULL);
      advancedSetting.setLayout(new GridLayout(1, false));

      Composite changebase = new Composite(advancedSetting, SWT.NULL);
      changebase.setLayout(new GridLayout(1, false));
      forceConvert = new Button(changebase, SWT.CHECK);
      forceConvert.setText(Messages.getString("mp3convert.forceconvert"));
      mp3setting = new MP3AudioSettingComposite(changebase, SWT.NULL, false, getPreferenceKey());
      ExpandItem item1 = new ExpandItem(bar, SWT.NONE, 1);
      item1.setText(Messages.getString("mp3convert.convertsetting"));
      item1.setHeight(advancedSetting.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item1.setControl(advancedSetting);

      Composite bitrateBase = new Composite(bar, SWT.NULL);
      bitrateBase.setLayout(new RowLayout());
      Label label1 = new Label(bitrateBase, SWT.NULL);
      label1.setText(Messages.getString("mp3convert.defaultBitrate"));
      defaultBitrate = new CCombo(bitrateBase, SWT.NULL);
      int bitrates[] = {64, 80, 96, 112, 128, 160, 192, 224, 256, 320};
      for (int i = 0; i < bitrates.length; i++) {
        defaultBitrate.add("" + bitrates[i]);
      }
      defaultBitrate.select(4);
      Label label = new Label(bitrateBase, SWT.NULL);
      label.setText("kbps");

      ExpandItem item2 = new ExpandItem(bar, SWT.NONE, 2);
      item2.setText(Messages.getString("mp3convert.optionbitrate"));
      item2.setHeight(bitrateBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item2.setControl(bitrateBase);

      forceConvert.addSelectionListener(new SynchEnabled(mp3setting));

      Composite avisynthBase = new Composite(bar, SWT.NULL);
      avisynthBase.setLayout(new RowLayout());
      useAvisynth = new Button(avisynthBase, SWT.CHECK);
      useAvisynth.setText(Messages.getString("mp3convert.useAvisynth"));
      // quickCopy.setSelection(true);//

      ExpandItem item3 = new ExpandItem(bar, SWT.NONE, 3);
      item3.setText(Messages.getString("mp3convert.about_useAvisynth"));
      item3.setHeight(avisynthBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item3.setControl(avisynthBase);

      canConvertImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_mp3.png")
              .createImage();
      noFFMpegImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_noffmpeg.png")
              .createImage();
      // bitrate
      // framerate
      // channel

      dragHere = new CLabel(composite, SWT.BORDER | SWT.LEFT);
      dragHere.setBackground(ColorConstants.white);
      dragHere.setImage(canConvertImage);
      dragHere.setAlignment(SWT.CENTER);

      dragHere.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // keep preference store
      SavePreferenceStore sps = new SavePreferenceStore();

      // restore from setting..
      restoreControl(forceConvert);
      restoreControl(quickCopy);
      restoreControl(defaultBitrate);
      restoreControl(useAvisynth);

      forceConvert.addSelectionListener(sps);
      quickCopy.addSelectionListener(sps);
      defaultBitrate.addSelectionListener(sps);
      useAvisynth.addSelectionListener(sps);

      mp3setting.setEnabled(forceConvert.getSelection());
      mp3setting.setPreferenceStore(getPreferenceStore());

      // update status
      setCanConvert(true);
      updateStatus();
      PlatformUI.getPreferenceStore().addPropertyChangeListener(new SettingMonitor());
      return composite;
    }
  /**
   * Constructor for TabbedPropertyTitle.
   *
   * @param parent the parent composite.
   * @param factory the widget factory for the tabbed property sheet
   */
  public TabbedPropertyTitle(Composite parent, FormWidgetFactory factory) {
    super(parent, SWT.NONE);
    this.factory = factory;

    bg = factory.getColors().getColor(FormColors.TB_BG);
    gbg = factory.getColors().getColor(FormColors.TB_GBG);
    border = factory.getColors().getColor(FormColors.TB_BORDER);

    this.addPaintListener(
        new PaintListener() {

          public void paintControl(PaintEvent e) {
            if (image == null && (text == null || text.equals(BLANK))) {
              label.setVisible(false);
            } else {
              label.setVisible(true);
              drawTitleBackground(e);
            }
          }
        });

    this.addFocusListener(
        new FocusListener() {

          public void focusGained(FocusEvent e) {
            if (toolbar != null) {
              toolbar.setFocus();

            } else getParent().setFocus();
          }

          public void focusLost(FocusEvent e) {
            // TODO Auto-generated method stub

          }
        });

    factory.getColors().initializeSectionToolBarColors();
    setBackground(factory.getColors().getBackground());
    setForeground(factory.getColors().getForeground());

    FormLayout layout = new FormLayout();
    layout.marginWidth = ITabbedPropertyConstants.HSPACE + 6;
    layout.marginHeight = 5;
    setLayout(layout);

    label =
        new CLabel(this, SWT.NONE) {

          public Point computeSize(int wHint, int hHint, boolean changed) {
            Point p = super.computeSize(wHint, hHint, changed);
            p.y = p.y + 2;
            return p;
          }
        };
    label.setBackground(parent.getBackground());
    label.setText(BLANK);
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    label.setLayout(gl);

    // resetButton = new Button( label, SWT.FLAT );
    //		resetButton.setText( Messages.getString( "TabbedPropertyTitle.Button.Default.Text" ) );
    // //$NON-NLS-1$
    // GridData gd = new GridData( );
    // gd.grabExcessHorizontalSpace = true;
    // gd.horizontalAlignment = SWT.END;
    // gd.grabExcessVerticalSpace = true;
    // gd.verticalAlignment = SWT.CENTER;
    // resetButton.setLayoutData( gd );
    // resetButton.setVisible( false );
    // resetButton.addSelectionListener( new SelectionAdapter( ) {
    //
    // public void widgetSelected( SelectionEvent e )
    // {
    // Event event = new Event( );
    // event.widget = resetButton;
    // TabbedPropertyTitle.this.notifyListeners( SWT.SELECTED, event );
    // }
    //
    // } );
    //		resetButton.setToolTipText( Messages.getString(
    // "TabbedPropertyTitle.Button.Default.TooltipText" ) ); //$NON-NLS-1$

    label.setBackground(
        new Color[] {
          factory.getColors().getColor(FormColors.TB_BG),
          factory.getColors().getColor(FormColors.TB_GBG)
        },
        new int[] {100},
        true);
    label.setFont(JFaceResources.getBannerFont());
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.top = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    label.setLayoutData(data);

    /*
     * setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
     * ISharedImages.IMG_OBJ_ELEMENT));
     */
  }
Exemple #11
0
 /**
  * Specify a gradient of colours to be drawn in the background of the CLabel.
  *
  * <p>For example, to draw a gradient that varies from dark blue to blue and then to white and
  * stays white for the right half of the label, use the following call to setBackground:
  *
  * <pre>
  * clabel.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
  * 	                           display.getSystemColor(SWT.COLOR_BLUE),
  * 	                           display.getSystemColor(SWT.COLOR_WHITE),
  * 	                           display.getSystemColor(SWT.COLOR_WHITE)},
  * 	               new int[] {25, 50, 100});
  * </pre>
  *
  * @param colors an array of Color that specifies the colors to appear in the gradient in order of
  *     appearance from left to right; The value <code>null</code> clears the background gradient;
  *     the value <code>null</code> can be used inside the array of Color to specify the background
  *     color.
  * @param percents an array of integers between 0 and 100 specifying the percent of the width of
  *     the widget at which the color should change; the size of the percents array must be one
  *     less than the size of the colors array.
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *       <li>ERROR_INVALID_ARGUMENT - if the values of colors and percents are not consistent
  *     </ul>
  */
 public void setBackground(Color[] colors, int[] percents) {
   setBackground(colors, percents, false);
 }