@@ -2743,6 +2743,19 @@ private void SortLayers(sbyte sortBy)
2743
2743
kmzLayers.Visible = true;
2744
2744
}
2745
2745
2746
+ private void SortByMouse()
2747
+ {
2748
+ kmzLayers.Sorted = false;
2749
+ kmzLayers.SortBy = (byte)0;
2750
+ sortByAddingToolStripMenuItem.Checked = false;
2751
+ sortASCToolStripMenuItem.Checked = false;
2752
+ sortByObjectsCountToolStripMenuItem.Checked = false;
2753
+ sortByCheckedToolStripMenuItem.Checked = false;
2754
+ sortByO.Checked = false;
2755
+ sortByL.Checked = false;
2756
+ sortByA.Checked = false;
2757
+ }
2758
+
2746
2759
private void MoveLayerUp_Click(object sender, EventArgs e)
2747
2760
{
2748
2761
if (kmzLayers.SelectedIndex < 1) return;
@@ -7950,6 +7963,47 @@ private void importFromShapeFileToolStripMenuItem_Click(object sender, EventArgs
7950
7963
ImportFromSHP(ofd.FileName);
7951
7964
ofd.Dispose();
7952
7965
}
7966
+
7967
+ private object kmzl_temp;
7968
+ private int kmzl_trackingItem;
7969
+ private bool kmzl_checked;
7970
+
7971
+ private void kmzLayers_MouseUp(object sender, MouseEventArgs e)
7972
+ {
7973
+ if (kmzLayers.SelectedIndex < 0) return;
7974
+ if (kmzl_temp != null)
7975
+ {
7976
+ int tempInd = kmzLayers.SelectedIndex;
7977
+ if ((tempInd >= 0) && (kmzl_trackingItem != tempInd))
7978
+ {
7979
+ kmzLayers.Items.RemoveAt(kmzl_trackingItem);
7980
+ kmzLayers.Items.Insert(tempInd, kmzl_temp);
7981
+ kmzLayers.SelectedIndex = tempInd;
7982
+ kmzLayers.SetItemChecked(tempInd, kmzl_checked);
7983
+ };
7984
+ kmzLayers.Cursor = Cursors.Default;
7985
+ kmzl_temp = null;
7986
+ kmzLayers.MovingItem = null;
7987
+ };
7988
+ }
7989
+
7990
+ private void kmzLayers_MouseDown(object sender, MouseEventArgs e)
7991
+ {
7992
+ if (kmzLayers.SelectedIndex < 0) return;
7993
+
7994
+ if ((Control.ModifierKeys & Keys.Alt) == Keys.Alt)
7995
+ {
7996
+ kmzLayers.Cursor = Cursors.Hand;
7997
+ kmzl_trackingItem = kmzLayers.SelectedIndex;
7998
+ if (kmzl_trackingItem >= 0)
7999
+ {
8000
+ SortByMouse();
8001
+ kmzl_temp = kmzLayers.Items[kmzl_trackingItem];
8002
+ kmzl_checked = kmzLayers.GetItemChecked(kmzl_trackingItem);
8003
+ kmzLayers.MovingItem = kmzl_temp;
8004
+ };
8005
+ };
8006
+ }
7953
8007
}
7954
8008
7955
8009
public class FilesListBox : CheckedListBox
@@ -8176,7 +8230,7 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8176
8230
{
8177
8231
bool isChecked = GetItemChecked(e.Index);
8178
8232
bool isSelected = ((e.State & DrawItemState.Selected) == DrawItemState.Selected);
8179
- KMLayer kml = (KMLayer)this.Items[e.Index];
8233
+ KMLayer kml = (KMLayer)this.Items[e.Index];
8180
8234
8181
8235
if (isChecked)
8182
8236
{
@@ -8192,6 +8246,13 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8192
8246
e.Graphics.FillRectangle(kml.placemarks > 0 ? Brushes.Yellow : Brushes.LightGoldenrodYellow, e.Bounds);
8193
8247
};
8194
8248
8249
+ if ((MovingItem != null) && isSelected)
8250
+ {
8251
+ e.Graphics.FillRectangle(Brushes.Fuchsia, e.Bounds);
8252
+ if(isChecked) e.Graphics.DrawString("v", new Font(e.Font, FontStyle.Bold), isSelected ? SystemBrushes.HighlightText : SystemBrushes.WindowText, new PointF(dx + 1, e.Bounds.Top));
8253
+ kml = (KMLayer)MovingItem;
8254
+ };
8255
+
8195
8256
Pen myp = new Pen(new SolidBrush(Color.FromArgb(230,230,250)));
8196
8257
myp.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
8197
8258
e.Graphics.DrawLine(myp, new Point(e.Bounds.Left, e.Bounds.Bottom - 1), new Point(e.Bounds.Right, e.Bounds.Bottom - 1));
@@ -8208,18 +8269,18 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8208
8269
8209
8270
// DRAW VERT
8210
8271
e.Graphics.DrawLine(myp, new Point(offset + txtwi, e.Bounds.Top), new Point(offset + txtwi, e.Bounds.Bottom - 1));
8211
- offset += 4;
8272
+ offset += 4;
8212
8273
8213
8274
// DRAW LAYER NO
8214
8275
string layNo = kml.id.ToString("000") + " in";
8215
8276
e.Graphics.DrawString(layNo, e.Font, isSelected ? SystemBrushes.HighlightText : Brushes.Silver, new Rectangle(offset + txtwi, e.Bounds.Top, e.Bounds.Width - offset - txtwi, e.Bounds.Height), StringFormat.GenericTypographic);
8216
- txtwi += (int)e.Graphics.MeasureString(layNo + ".", e.Font, 0, StringFormat.GenericTypographic).Width;
8277
+ txtwi += (int)e.Graphics.MeasureString(layNo + ".", e.Font, 0, StringFormat.GenericTypographic).Width;
8217
8278
8218
8279
// DRAW FILE NAME
8219
8280
e.Graphics.DrawString(kml.file.src_file_nme, e.Font, isSelected ? SystemBrushes.HighlightText : Brushes.Maroon, new Rectangle(offset + txtwi, e.Bounds.Top, e.Bounds.Width - offset - txtwi, e.Bounds.Height), StringFormat.GenericDefault);
8220
8281
txtwi += GetFileLength(e.Index, e.Font, e.Graphics);
8221
- if (txtwi < n_W_f) txtwi = n_W_f;
8222
-
8282
+ if (txtwi < n_W_f) txtwi = n_W_f;
8283
+
8223
8284
// DRAW VERT
8224
8285
e.Graphics.DrawLine(myp, new Point(offset + txtwi, e.Bounds.Top), new Point(offset + txtwi, e.Bounds.Bottom - 1));
8225
8286
offset += 4;
@@ -8236,15 +8297,15 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8236
8297
string prefCnt = "000000".Remove(0, kml.placemarks.ToString("").Length > 6 ? 0 : kml.placemarks.ToString("").Length);
8237
8298
string mainCnt = kml.placemarks.ToString("");
8238
8299
string[] after_text = new string[]{
8239
- "000000".Remove(1, kml.points.ToString("").Length > 6 ? 0 : kml.points.ToString("").Length),
8240
- kml.points.ToString(""),
8241
- "000000".Remove(1, kml.lines.ToString("").Length > 6 ? 0 : kml.lines.ToString("").Length),
8242
- kml.lines.ToString(""),
8243
- "000000".Remove(1, kml.areas.ToString("").Length > 6 ? 0 : kml.areas.ToString("").Length),
8244
- kml.areas.ToString(""),
8245
- copyText,
8246
- descText
8247
- };
8300
+ "000000".Remove(1, kml.points.ToString("").Length > 6 ? 0 : kml.points.ToString("").Length),
8301
+ kml.points.ToString(""),
8302
+ "000000".Remove(1, kml.lines.ToString("").Length > 6 ? 0 : kml.lines.ToString("").Length),
8303
+ kml.lines.ToString(""),
8304
+ "000000".Remove(1, kml.areas.ToString("").Length > 6 ? 0 : kml.areas.ToString("").Length),
8305
+ kml.areas.ToString(""),
8306
+ copyText,
8307
+ descText
8308
+ };
8248
8309
e.Graphics.DrawString(prefCnt, e.Font, isSelected ? Brushes.Black : Brushes.Silver, new Rectangle(offset + txtwi, e.Bounds.Top, e.Bounds.Width - offset - txtwi, e.Bounds.Height), StringFormat.GenericTypographic);
8249
8310
txtwi += (int)e.Graphics.MeasureString(prefCnt, e.Font, 0, StringFormat.GenericTypographic).Width;
8250
8311
e.Graphics.DrawString(mainCnt, e.Font, isSelected ? SystemBrushes.HighlightText : (kml.placemarks == 0 ? Brushes.Red : Brushes.Blue), new Rectangle(offset + txtwi, e.Bounds.Top, e.Bounds.Width - offset - txtwi, e.Bounds.Height), StringFormat.GenericTypographic);
@@ -8259,7 +8320,7 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8259
8320
txtwi += (int)e.Graphics.MeasureString(after_text[at], e.Font, 0, StringFormat.GenericTypographic).Width;
8260
8321
if (at % 2 == 1)
8261
8322
{
8262
- offset += 4;
8323
+ offset += 4;
8263
8324
e.Graphics.DrawLine(myp, new Point(offset + txtwi, e.Bounds.Top), new Point(offset + txtwi, e.Bounds.Bottom - 1));
8264
8325
offset += 3;
8265
8326
};
@@ -8278,7 +8339,7 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8278
8339
bt = isSelected ? SystemBrushes.HighlightText : Brushes.Goldenrod;
8279
8340
e.Graphics.DrawString(after_text[at], ft, bt, new Rectangle(offset + txtwi, e.Bounds.Top, e.Bounds.Width - offset - txtwi, e.Bounds.Height), StringFormat.GenericTypographic);
8280
8341
txtwi += (int)e.Graphics.MeasureString(after_text[at], ft, 0, StringFormat.GenericTypographic).Width;
8281
- };
8342
+ };
8282
8343
8283
8344
// DRAW OBJECTS INFO
8284
8345
if (isSelected)
@@ -8293,6 +8354,8 @@ protected override void OnDrawItem(DrawItemEventArgs e)
8293
8354
};
8294
8355
};
8295
8356
}
8357
+
8358
+ public object MovingItem = null;
8296
8359
}
8297
8360
8298
8361
public class KMFile
0 commit comments